Private Sub Application_Startup() Dim olApp As Outlook.Application Dim o1ShareName As Outlook.Recipient
Set olApp = Outlook.Application Set o1ShareName = GetNS(o1ShareName).CreateRecipient("email@email.ca") Set Items = GetNS(olApp).GetDefaultFolder(olFolderInbox).Folders("printed invoices").Items End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the 'printed invoices' folder."
Dim MsgReply As Outlook.MailItem Set MsgReply = item.Reply With MsgReply .Subject = "Re " & item.Subject .HTMLBody = "Hello" & MsgReply.HTMLBody .Send End With Set MsgReply = Nothing
ProgramExit: Exit Sub ErrorHandler: MsgBox Err.Number & " - " & Err.Description Resume ProgramExit End Sub
Function GetNS(ByRef app As Outlook.Application) As Outlook.NameSpace Set GetNS = app.GetNamespace("MAPI") End Function
برچسب:
نویسنده: استخدام کار