1

I have VBA code in a non-person mailfile. I need it to run without anyone being logged into that Outlook account. It saves Excel attachments to a network share (see below). It is currently set to run as a rule against all new incoming mails.


Public Sub saveAttachtoDisk(itm As Outlook.MailItem)

Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(Now, "mmdd H-mm")

saveFolder = "C:\Test\One"

For Each objAtt In itm.Attachments
  If Right(objAtt.FileName, 3) = "xls" Or Right(objAtt.FileName, 4) = "xlsx" Then
    objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
    Set objAtt = Nothing
  End If
Next

End Sub

Is it possible to automate this rule to run without being logged into an Outlook client?

4

1 回答 1

0

你不能。

“因为 Outlook Visual Basic for Applications 代码在客户端上运行,所以必须运行 Outlook 才能运行代码。”

http://support.microsoft.com/kb/324568

于 2013-11-11T19:29:23.500 回答