M
matt
Hello,
I am using this code below to put the contents of the document into the body
of an Outlook email. Almost everything works perfect except for three Excel
Graphs that are links from Excel into the Word doc. When they show up in the
body of the email (before and after it is sent) they are blow up about 3x's
the size they are in the Word document. Why would this happen? I have try
..formattedtext etc.. and nothing seems to fix it.
Also there is a picture in the Word doc (.GIF) that is copy/pasted into the
doc, and when it is displayed in the message body it has the red "x" and it
says, "The image cannot be displayed. Your computer may not have enough
memory to open the image, or the image may have been corrupted. (etc....)".
If I delete it and copy/paste it directly into the message body it displays
correctly, just not when I use the code.
Any info would be much appreciated!!
_____________________________________________________
Sub SendDocumentInMail()
'Send document in body of email
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
'Outlook wasn't running? Start it from code.
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
'Set the recipient for the new email
.To = "(e-mail address removed)"
'Set the recipient for a copy
.CC = "(e-mail address removed)"
'Set the subject
.Subject = "Daily Report"
'The content of the document is used as the body for the email
'ActiveDocument.Range.FormattedText
'Selection.Copy
ActiveDocument.Range.Copy
.GetInspector.WordEditor.Range.Paste
End With
If bStarted Then
'If started Outlook from code, then close it
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
_______________________________________________________
I am using this code below to put the contents of the document into the body
of an Outlook email. Almost everything works perfect except for three Excel
Graphs that are links from Excel into the Word doc. When they show up in the
body of the email (before and after it is sent) they are blow up about 3x's
the size they are in the Word document. Why would this happen? I have try
..formattedtext etc.. and nothing seems to fix it.
Also there is a picture in the Word doc (.GIF) that is copy/pasted into the
doc, and when it is displayed in the message body it has the red "x" and it
says, "The image cannot be displayed. Your computer may not have enough
memory to open the image, or the image may have been corrupted. (etc....)".
If I delete it and copy/paste it directly into the message body it displays
correctly, just not when I use the code.
Any info would be much appreciated!!
_____________________________________________________
Sub SendDocumentInMail()
'Send document in body of email
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
'Outlook wasn't running? Start it from code.
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
'Set the recipient for the new email
.To = "(e-mail address removed)"
'Set the recipient for a copy
.CC = "(e-mail address removed)"
'Set the subject
.Subject = "Daily Report"
'The content of the document is used as the body for the email
'ActiveDocument.Range.FormattedText
'Selection.Copy
ActiveDocument.Range.Copy
.GetInspector.WordEditor.Range.Paste
End With
If bStarted Then
'If started Outlook from code, then close it
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
_______________________________________________________