hi all,
i have a following VBA but it keeps trowing a runtime 438 error object doesn't support property or method. ms outlook library 16.0 is active
file saving works, just can launch Outlook and send. Any ideas?
i have a following VBA but it keeps trowing a runtime 438 error object doesn't support property or method. ms outlook library 16.0 is active
file saving works, just can launch Outlook and send. Any ideas?
Code:
Public Sub SaveAndSendPDF()
Dim OutApp, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
myPath = "N:\AX\Reports\InventoryShiftReports\"
strDate = Format(Date, "ddmmyyyy")
PDF = myPath & "InventoryShiftReport" & "_" & strDate & "_" & Environ("Username") & ".pdf"
With ActiveSheet.Range("A1:G40")
.ExportAsFixedFormat Type:=xlTypePDF, FileName:=PDF_File
End With
OutApp.Visible = True
With myMail
.Subject = "Stock Inventory report " & Date
.To = ""
.Body = "<H3>Hi All,</H3><br><br>" & _
"******>Please see the attached PDF file with the latest report." & _
"<br><br>" & "Kind Regards,</body>"
.Signature = True
.Attachments.Add PDF
.Display
End With
Set OutApp = Nothing
Set OutMail = Nothing
End Sub