I'm trying to attach an activeworkbook to email I'm send out with the following code. The part that doesn't work is in bold. Thanks for your help.
Sub SendEmailUsingWordEditor()
Dim myolApp As Outlook.Application
Dim olEmail As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Word.Document
Dim strGreeting As String
Dim pulled_data As Worksheet
'Set pulled_data = ThisWorkbook.Worksheets("Records")
'workweek_for_email = pulled_data.Range("B13").Value
strGreeting = "Hi Team,"
Set myolApp = New Outlook.Application
Set olEmail = myolApp.CreateItemFromTemplate("C:\Users\rbirch\AppData\Roaming\Microsoft\Templates\DOM Forecast Status Report (Month Day Year).oft")
With olEmail
.BodyFormat = olFormatRichText
.Display
.Subject = "DOM Forecast Status Report" & workweek_for_email
.Attachments.Add (ActiveDocument.FullName)
'.Add.Attachment.ActiveWorkbook
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
wdDoc.Range.InsertBefore strGreeting
ThisWorkbook.Worksheets("Weekly Tracker").Activate
Range("B2:L34").CurrentRegion.Copy
wdDoc.Range(Len(strGreeting), Len(strGreeting)).Paste
End With
End Sub
Bookmarks