shudder
02-09-2017, 10:05 AM
Hi Guys,
I have found the below code which opens a word doc and copies the text into an email.
However, even though the default font in both Outlook and Word are set the same (Arial, 10pts) when pasting it changes it to the font to Calibri (Body), 11pts.
Is there any way to correct this or an alternate routine?
Sub CopyBodyFromWord()
Dim oMailItem As Object
Dim oWordApp As Object
Dim oWordDoc As Object
Dim oMailWordDoc As Object
On Error GoTo CleanUp
Set oWordApp = CreateObject("Word.Application")
Set oWordDoc = oWordApp.Documents.Open("C:\Users\User\Desktop\Test.docx")
oWordDoc.Content.Copy
Set oMailItem = Application.CreateItem(0)
With oMailItem
.Display
End With
Set oMailWordDoc = Application.ActiveInspector.WordEditor
oMailWordDoc.Application.Selection.Paste
CleanUp:
oWordApp.Quit
Set oMailWordDoc = Nothing
Set oMailItem = Nothing
Set oWordDoc = Nothing
Set oWordApp = Nothing
End Sub
Thanks in advance :)
I have found the below code which opens a word doc and copies the text into an email.
However, even though the default font in both Outlook and Word are set the same (Arial, 10pts) when pasting it changes it to the font to Calibri (Body), 11pts.
Is there any way to correct this or an alternate routine?
Sub CopyBodyFromWord()
Dim oMailItem As Object
Dim oWordApp As Object
Dim oWordDoc As Object
Dim oMailWordDoc As Object
On Error GoTo CleanUp
Set oWordApp = CreateObject("Word.Application")
Set oWordDoc = oWordApp.Documents.Open("C:\Users\User\Desktop\Test.docx")
oWordDoc.Content.Copy
Set oMailItem = Application.CreateItem(0)
With oMailItem
.Display
End With
Set oMailWordDoc = Application.ActiveInspector.WordEditor
oMailWordDoc.Application.Selection.Paste
CleanUp:
oWordApp.Quit
Set oMailWordDoc = Nothing
Set oMailItem = Nothing
Set oWordDoc = Nothing
Set oWordApp = Nothing
End Sub
Thanks in advance :)