• Subject: Re: Using VBA to send Word document as body of message works in 2007, but not in 2003
  • Author: Doug Robbins - Word MVP
  • Date: 16 Feb 2010
  • References: 1 2 3 4 5 6
Thanks, Sue.

I have now determined that it must be something to do with the particular
installation of Office.

Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
news:O$jZuRdrKHA.4460@TK2MSFTNGP05.phx.gbl...
> On the pure Office 2003 machines, did you install Outlook and Word from
> the same SKU? If not, I think the Office Envelope functionality (among
> other features) won't work.
>
> Also, I don't know what you mean about this code being related to the
> add-in. If add-ins are present, maybe disabling them would reveal
> something useful.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> wrote in message
> news:C17CA250-3146-43B1-9F42-FE559A10C2DD@microsoft.com...
>> Hi Sue,
>>
>> While ActiveDocument.MailEnvelope also errors out in Word 2007, in that
>> version, ActiveDocument.MailEnvelope.Parent returns the name of the
>> active document, but it gives the 430 error message in Word 2003.
>>
>> Also, I have now tried that on machines that have never had anything
>> later than Office 2003 installed on them with the same result.
>>
>> --
>> Hope this helps,
>>
>> Doug Robbins - Word MVP
>>
>> Please reply only to the newsgroups unless you wish to obtain my services
>> on
>> a paid professional basis.
>>
>> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
>> news:%23mu0mwarKHA.3792@TK2MSFTNGP05.phx.gbl...
>>> What does ActiveDocument.MailEnvelope return?
>>>
>>> "Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> wrote in message
>>> news:OBxY0jTrKHA.3800@TK2MSFTNGP06.phx.gbl...
>>>> Hi Sue,
>>>>
>>>> Yes, it is being run from Word. It is in the Word 2003 version of the
>>>> add-in that can be downloaded from:
>>>>
>>>> http://www.gmayor.com/ManyToOne.htm
>>>>
>>>> However, in the 2003 version that is available there, the "Merge to
>>>> Email Message" facility has been disabled.
>>>>
>>>> The error is being caused by the
>>>>
>>>> Set objDoc = .MailEnvelope.Item
>>>>
>>>> command. Note that line of code is inside a With ActiveDocument...End
>>>> With construction, and when writing the code, the intellisense provides
>>>> MailEnvelope.Item as a suggestion.
>>>>
>>>> --
>>>> Regards,
>>>>
>>>> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>>>>
>>>> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
>>>> news:u7E2jHTrKHA.728@TK2MSFTNGP04.phx.gbl...
>>>>> Which statement raises that error? You're running this code in Word
>>>>> VBA?
>>>>>
>>>>> "Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> wrote in message
>>>>> news:ef5ottSrKHA.5896@TK2MSFTNGP04.phx.gbl...
>>>>>> As a followup, if I remove the On Error Resume Next, the following
>>>>>> error message is displayed:
>>>>>>
>>>>>> 430 Class does not support Automation or does not support expected
>>>>>> interface
>>>>>>
>>>>>>> Based on Sue Mosher's code at
>>>>>>> http://www.outlookcode.com/codedetail.aspx?id=1333, the following
>>>>>>> code, which is located inside a With ActiveDocument - End With
>>>>>>> construction, works fine in Word 2007:
>>>>>>>
>>>>>>> Set objDoc = .MailEnvelope.Item
>>>>>>> With objDoc
>>>>>>> .To = strEmail
>>>>>>> .Subject = strSubject
>>>>>>> .Save
>>>>>>> strID = .EntryID
>>>>>>> End With
>>>>>>> Set objDoc = Nothing
>>>>>>> Set objDoc =
>>>>>>> oOutlookApp.Session.GetItemFromID(strID)
>>>>>>> With objDoc
>>>>>>> .Send
>>>>>>> End With
>>>>>>> Set objDoc = Nothing
>>>>>>>
>>>>>>> ObjDoc is declared as an Object and strID as a String and earlier in
>>>>>>> the code there is the following:
>>>>>>>
>>>>>>> On Error Resume Next
>>>>>>> Set oOutlookApp = GetObject(, "Outlook.Application")
>>>>>>> If Err <> 0 Then
>>>>>>> Set oOutlookApp = CreateObject("Outlook.Application")
>>>>>>> bStarted = True
>>>>>>> End If
>>>>>>>
>>>>>>> In Word 2003 however, it does not work and testing for strID using
>>>>>>> MsgBox strID after it is set to .EntryID, I just get an empty
>>>>>>> message box so that it appears that .EntryID is not being assigned.
>>>>>>>
>>>>>>> Any clues on how to overcome this?
>
>
13 Feb 2010Using VBA to send Word document as body of message works in 2007, but not in ....Doug Robbins - Word MVP
14 Feb 2010\ Re: Using VBA to send Word document as body of message works in 2007, but not....Doug Robbins - Word MVP
14 Feb 2010   \ Re: Using VBA to send Word document as body of message works in 2007, but not....Sue Mosher [MVP]
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)