View Single Post
  #11  
Old August 18th 06, 03:05 PM posted to microsoft.public.outlook.program_vba
LongWayFromHome
external usenet poster
 
Posts: 7
Default Sample Code for Merge With Attachments?

OK. Adding the Word library reference cleared all the compile errors shown
above. Thank you!

Now I am getting new "Method or Data Member not found" compile errors. I
obviously made a mistake in attempting to follow your direction about
deriving Dialogs from a Word.Application object. Here are the lines I think
might be pertinent. The errors occur on all the .Methods:

Dim wdWordApp As Word.Application
Dim wdItem As Word.MailMessage
Set wdWordApp = GetObject(, "Word.Application")

Set wdItem = wdWordApp.MailMessage
With wdItem
' .Subject = mysubject
' .Body = ActiveDocument.Content
Set Datarange = Maillist.Tables(1).Cell(Counter, 1).Range
Datarange.End = Datarange.End - 1
' .To = Datarange
For i = 2 To Maillist.Tables(1).Columns.Count
Set Datarange = Maillist.Tables(1).Cell(Counter, i).Range
Datarange.End = Datarange.End - 1
' .Attachments.Add Trim(Datarange.Text), olByValue, 1
Next i
' .Send
End With

Sorry to be so lost on this.

Thanks.
--
Dave


"Sue Mosher [MVP-Outlook]" wrote:

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.


Ads