The following code will post a word document to Outlook.
However the word document is posted inside an email message.
Is there anyway of posting the word document as itself to Outlook (for instance when you drag a document to Outlook using the mouse then it is posted as itself)
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
MyPath = "C:\temp\"
myname = "dump"
'Return a reference to the MAPI layer
Set ns = ol.GetNamespace("MAPI") 'tg 22/09 sometimes causes EXcel failure
'Point to Public Folder
Set PubFolder = ns.Folders("Public Folders").Folders("All Public Folders").Folders("Projects")
Set newPost = PubFolder.Items.Add(olPostItem)
.Subject = myname
.Attachments.Add MyPath & myname, olByValue, , myname
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.