Excel- Outlookproblem
01.10.2003 15:26:42
Andreas Schindler
ich bekomme bei folgender Routine ab ca. 250 Einträgen eine Fehlermeldung
-2147352567 Array außerhalb des zulässigen Bereiches
Habe ich beim Dimensionieren einen Fehler gemacht?
Wie kann ich die Items dimensionieren?
Dim objOutlook As Object
Dim objnSpace As Object
Dim objFolder As Object
Dim objMsg As Object
Dim intCounter As Integer, intCount As Integer, iRow As Integer
Dim optionenzaehler
Dim sTxt As String
Dim Verzeichnis As String
Dim Absender() As String
Dim Betreff() As String
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Postfach - UBW").Folders("Ablage UEBW-XLS") ' "Posteingang"
Set destFolder = objnSpace.Folders("Postfach - UBW").Folders("Archiv (Aufträge älter als 22 Tage)")
Application.ScreenUpdating = False
intCount = objFolder.Items.Count
If intCount <> 0 Then
ReDim Absender(intCount) As String
ReDim Betreff(intCount) As String
antwortzaehler = 0
For i = 1 To intCount
Set objMsg = objFolder.Items(i) ' <=== Hier springt der Debugger hin
If DateDiff("d", Format(objMsg.SentOn, "dd.mm.yyyy"), Now) > 22 Then
antwortzaehler = antwortzaehler + 1
objMsg.Move destFolder
End If
Application.StatusBar = "Analysiere " & i & " von " & intCount & ". Ins Archiv übernommen, da älter als 22 Tage: " & antwortzaehler
Next i
End If
Set objnSpace = Nothing
Set objFolder = Nothing
Set objOutlook = Nothing
Viele Grüße und vielen Dank für Eure Hilfe