title image


Smiley Re: Ordner in Outlook ansprechen (VB 6)
Hi Carmen.



Besten Dank für Deine Hilfe. Ich habe mittlerweile noch ein weiteres Problemchen.

Und zwar möchte ich mit folgendem Code, alle Items aus dem SourceFolder in den

TargetFolder verschieben. Bekomme aber seltsame [unbekannte] Fehler.Public Function MoveItems(SourceFolder As String, TargetFolder As String)



'On Error Resume Next



Dim objMyMailbox As MAPIFolder

Dim objSourceFolder As MAPIFolder

Dim objTargetFolder As MAPIFolder

Dim oItems() As Object

Dim objItem As Object



Dim iItemsCount As Integer

Dim iProcess As Integer

Dim i As Integer



Set objOL = New Outlook.Application

Set objNS = objOL.GetNamespace("MAPI")

Set objMyMailbox = objNS.Folders(GetUserFullName)

Set objSourceFolder = objMyMailbox.Folders(SourceFolder)

Set objTargetFolder = objMyMailbox.Folders(TargetFolder)



frmMain.pgProcess.Max = objSourceFolder.Items.Count

frmMain.pgProcess.Min = 0



For iItemsCount = 1 To objSourceFolder.Items.Count

Set objItem = objSourceFolder.Items(iItemsCount)

ReDim Preserve oItems(iItemsCount)

Set oItems(iItemsCount) = objItem

frmMain.lblInfo.Caption = "Prepare Data"

frmMain.pgProcess.Value = iItemsCount

Next iItemsCount



frmMain.lblInfo.Caption = "Move " & iItemsCount & " Items from " & SourceFolder & " to " & TargetFolder

frmMain.pgProcess.Max = UBound(oItems)

frmMain.pgProcess.Min = 0

frmMain.pgProcess.Value = 0



For i = 1 To UBound(oItems)

frmMain.lblInfo.Caption = "Move " & i & " of " & UBound(oItems) & " Items from " & SourceFolder & " to " & TargetFolder

frmMain.lblInfo.Refresh

frmMain.pgProcess.Value = i

oItems(i).Move objTargetFolder

Next i



Exit Function



End FunctionGibt es eine bessere Variante als meine?

Ich wäre Dir für jeden Hinweise dankbar.



Gruss pmo


Besten Dank und Gruss aus der Schweiz pmo

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: