Doug Robbins - Word MVP
2010-02-14 03:56:12 UTC
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?
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?
--
Regards,
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
Regards,
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com