|
1.运行下面的代码时当收到和会议邀请有关的内容时就报错
Run-time error '-2147352567(80020009)':
Array index out of bounds.
2.能否帮助完善一下下面的代码, 可以把收到的特定标题的邮件删掉么?
谢谢各位大神
Public Sub Application_NewMail()
Dim myItem As Outlook.MailItem
Set myItem = Application.ActiveExplorer.Selection.Item(1)
Call sofWorkWithOutlook20082550
End Sub
Sub sofWorkWithOutlook20082550()
Dim outlookApp
Dim olNs As Outlook.NameSpace
Dim Fldr As Outlook.MAPIFolder
Dim olMail As Variant
Dim myTasks
Dim sir() As String
Dim xlapp As Object
Dim wb As Object
Dim sht As Object
Set outlookApp = CreateObject("Outlook.Application")
Set olNs = outlookApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set myTasks = Fldr.Items
For Each olMail In myTasks
If i > 0 Then
If (InStr(1, olMail.Subject, "FIT Vehicle Calendar Opened", vbTextCompare) > 0) Then
Set xlapp = CreateObject("Excel.Application")
xlapp.Visible = True
Set wb = xlapp.workbooks.Open("C:\EE\outlook\fit.xlsm")
Exit For
End If
End If
Next
End Sub
|
|