D
Dave
I am trying to write code to post a message into a public
folder. When I run the code I have written nothing
posts. Would greatly appreciate any suggestions to
correct the code I have written.
Sub AttachSalesFile()
Dim objOutlook As Outlook.Application
Dim objOutlookPst As Outlook.PostItem
Dim objNS As Outlook.NameSpace
Dim objFolder As MAPIFolder
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookPst = objOutlook.CreateItem(olPostItem)
Set objNS = objOutlook.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item("Public
Folders").Folders.Item("All Public Folders"). _
Folders.Item("Pottery Barn").Folders.Item("PB
Brand Finance")
Set objFolder = objNS.PickFolder
With objOutlookPst
.Subject = "JDA file for " & Date
' .Attachments.Add ("c:\MDCFiles\jda_cube.mdc")
.Post
End With
Set objOutlookPst = Nothing
Set objOutlook = Nothing
Set objNS = Nothing
Set objFolder = Nothing
End Sub
folder. When I run the code I have written nothing
posts. Would greatly appreciate any suggestions to
correct the code I have written.
Sub AttachSalesFile()
Dim objOutlook As Outlook.Application
Dim objOutlookPst As Outlook.PostItem
Dim objNS As Outlook.NameSpace
Dim objFolder As MAPIFolder
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookPst = objOutlook.CreateItem(olPostItem)
Set objNS = objOutlook.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item("Public
Folders").Folders.Item("All Public Folders"). _
Folders.Item("Pottery Barn").Folders.Item("PB
Brand Finance")
Set objFolder = objNS.PickFolder
With objOutlookPst
.Subject = "JDA file for " & Date
' .Attachments.Add ("c:\MDCFiles\jda_cube.mdc")
.Post
End With
Set objOutlookPst = Nothing
Set objOutlook = Nothing
Set objNS = Nothing
Set objFolder = Nothing
End Sub