I am trying to email a picture in the body of a Word Document. I need to code the equivalent to File -> Send To -> Mail Recipient. This is my code so far:
Private Sub cmdSubmit_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim Counter As Integer
Dim FileName As String
Dim bStarted As Boolean
Dim User As String
Dim AppPath As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
AppPath = ActiveDocument.FullName
User = Environ("USERNAME")
FileName = "c:\Documents and Settings\" & User & "\My Documents\Form.Doc"
Application.DisplayAlerts = False
ActiveDocument.SaveAs FileName
With OutMail
.To = "someone@somewhere.com"
.Cc = "CCSomeone"
.Body = ActiveDocument.Content
.Subject = "Subject"
ActiveDocument.SaveAs FileName
WordBasic.SendKeys "(%{1068})"
Selection.Paste
With ActiveDocument.InlineShapes(0)
.ScaleHeight = 100
.ScaleWidth = 100
End With
.Send
End With
If bStarted Then
OutApp.Quit
End If
'Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
My problem is that it emails fine, except the picture in the body of the Document doesn't come through in the body of the email message. I know the ActiveDocument.Content is supposed to be used for unformatted text, but I was hoping it would retain the picture. Any suggestions? DAVE
Private Sub cmdSubmit_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim Counter As Integer
Dim FileName As String
Dim bStarted As Boolean
Dim User As String
Dim AppPath As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
AppPath = ActiveDocument.FullName
User = Environ("USERNAME")
FileName = "c:\Documents and Settings\" & User & "\My Documents\Form.Doc"
Application.DisplayAlerts = False
ActiveDocument.SaveAs FileName
With OutMail
.To = "someone@somewhere.com"
.Cc = "CCSomeone"
.Body = ActiveDocument.Content
.Subject = "Subject"
ActiveDocument.SaveAs FileName
WordBasic.SendKeys "(%{1068})"
Selection.Paste
With ActiveDocument.InlineShapes(0)
.ScaleHeight = 100
.ScaleWidth = 100
End With
.Send
End With
If bStarted Then
OutApp.Quit
End If
'Clean up
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
My problem is that it emails fine, except the picture in the body of the Document doesn't come through in the body of the email message. I know the ActiveDocument.Content is supposed to be used for unformatted text, but I was hoping it would retain the picture. Any suggestions? DAVE