View Single Post
  #10  
Old August 17th 06, 10:32 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Sample Code for Merge With Attachments?

Document and Range are Word classes. DId you add a reference to Word to your VBA project?

Dialogs is also a Word class, and you'll need to derive it from a Word.Application object, not Outlook.Application.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"LongWayFromHome" wrote in message news
OK. Here is what I am doing, which I'm sure reflects my naivete with Outlook
and Word macros. I am following the MVP instructions as I understand them.

Word is running. The merge document (with the 9 emails) is open.

Outlook is running. Nothing in Outlook is open. I have copied the macro,
MergeWithAttachments, into Outlook VBA without changing anything. When I try
to compile the macro, these lines produce these errors:

Dim Source As Document: User-defined type not defined.
Dim Maillist As Document: ditto
Dim Datarange As Range: ditto
With Dialogs(wdDialogFileOpen): Sub or Function not defined. ("Dialogs" is
highlighted.)

When I comment-out these lines, the code compiles.


Ads