Sorry, that was the obvious problem. I should have looked for others, like:
Set wdItem = wdWordApp.MailMessage
You need to use Outlook's Application.CreateItem method to create the message. And
ActiveDocument.Content
This and other calls to Word objects need to use wdWordApp as their parent:
wdWordApp.ActiveDocument.Content
These are good basics to know, BTW, so don't feel like you're wasting time learning them.
--
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 ...
I have added your code, but Word has been open all along. GetObject returns
"Microsoft Word."
--
Dave
"Sue Mosher [MVP-Outlook]" wrote:
If Word is not running, GetObject(, "Word.Application") will return Nothing. You must test for that case and use CreateObject if necessary:
On Error Resume Next
Set wdWordApp = GetObject(, "Word.Application")
If wdWordApp Is Nothing Then
Set wdWordApp = CreateObject("Word.Application")
End If
"LongWayFromHome" wrote in message ...
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