L
LEE
I have a word file with VBA to save the content to Draft in Outlook. It works
but the link in the content change to text rather than link even if it is
actually a link in Word and I have set the mail format to HTML in Outlook. I
find the end of each line in the draft mail contain a space and the link
recovers if I delete the ending space. Grateful if you can help with the
following word VBA.
Private Sub CreateOutlookMessage()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
On Error GoTo ErrorMsgs
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olDraftItem)
With objOutlookMsg
.To = "(e-mail address removed)"
.Subject = "test"
.BodyFormat = olFormatHTML
.Body = ActiveDocument.Content
.Save
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Exit Sub
ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. For more information, " & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp. "
End If
End Sub
but the link in the content change to text rather than link even if it is
actually a link in Word and I have set the mail format to HTML in Outlook. I
find the end of each line in the draft mail contain a space and the link
recovers if I delete the ending space. Grateful if you can help with the
following word VBA.
Private Sub CreateOutlookMessage()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
On Error GoTo ErrorMsgs
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olDraftItem)
With objOutlookMsg
.To = "(e-mail address removed)"
.Subject = "test"
.BodyFormat = olFormatHTML
.Body = ActiveDocument.Content
.Save
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Exit Sub
ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. For more information, " & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp. "
End If
End Sub