Thank you for the assistance but all this method does is add the document as
an attachment. Is there a way to insert the text of the attachment into the
body of the email message? The same functionality is manualy produced by
clicking on Attach File andselecting the file I want. I then select the drop
down bar, next to the Insert button, and select "Insert as Text".
"Sue Mosher [MVP-Outlook]" wrote:
Your recorded macro was not for Outlook, but for Word. To convert it for use in Outlook VBA, you need to return a Word.Selection object from the mail message that the user current has open. It would look something like this:
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
objSel.InsertFile parameters
If you want to continue using ChangeFileOpenDirectory, you'll need to instantiate a Word.Application object, since that's the object that supports that method, not any Outlook object. To keep in simple, why not concatenate the path with the filename to get the full path?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Garan" wrote in message ...
I am new to Outlook Macros and Macros in general. I am trying to insert a
word document as text, into the body of a new email message.
I am using Outlook 2007 but it previously worked in Outlook 2003. The
debugger stops on ChangeFileOpenDirectory.
Sub Above_Average_credit()
'
' Macro recorded 6/26/2004 by Garan
'
ChangeFileOpenDirectory "\\Server01\Hawksoft\DOCUMENT\"
Selection.InsertFile FileName:="Above Average Credit.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub
I have tried searching this forum and also tried searching the web for
answers to my question with no luck. I know I could manually do what the
macro does but I have many documents with different macros for each one. I
have also tried to record a new macro in Word 2007, to eliminate
compatibilies with a different version of Word, but it spits out the same
macro commands. The macro works in Word 2007 but not Outlook.
What am I missing?