@Jason.Rugg try this. It will use the PDF with the same name & location as the open drawing. You said you had a rule to accomplish that already so it's not included in this iLogic rule to create the email & attach the PDF.
Sub Main
oOApp = CreateObject("Outlook.Application")
oOMail = oOApp.CreateItem(0)
Dim oDocument As Document = ThisApplication.ActiveDocument
Dim oFileName As String = oDocument.DisplayName.Replace(".idw", "")
oMessageBody = "<p style='font-family:calibri;font-size:16'>" & "Hello," & "<br><br>" & vbNewLine & vbNewLine & _
"This is the message body of the email for drawing: " & oFileName
' Create email.
With oOMail
.bodyformat=2
.To = ""
.CC = ""
.BCC = ""
.Subject = "This is an email with a PDF of drawing: " & oFileName
.Display
End With
' Add email message.
With oOMail
.HTMLbody = oMessageBody & vbNewLine & .HTMLBody ' Add the signature without losing the HTML-formatting.
End With
' Add PDF.
Try
With oOMail
.Attachments.Add(oDocument.FullFileName.Replace(".idw", ".pdf"))
End With
Catch
MsgBox("Unable to attach the PDF.")
End Try
End Sub
If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.