I have created a sheet in excel that I send to the printer. I would also like to create it as a PDF file and email it to a friend.
Can this be done using VBA?
I have created a sheet in excel that I send to the printer. I would also like to create it as a PDF file and email it to a friend.
Can this be done using VBA?
With some adjustments, this should get you there. Before running, in the VBA window select Tools - References and make sure the Microsoft Outlook xx.0 Object Library is selected.
![]()
Option Explicit Dim PDF As String, olApp As Outlook.Application, olMail As MailItem Sub EmailPDF() PDF = "C:\Users\natefarm\Desktop\Book1.pdf" Sheets("Sheet2").ExportAsFixedFormat Type:=xlTypePDF, Filename:=PDF Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) With olMail .To = "name@wherever.com" .CC = "" .Subject = "See attached PDF" .Body = "Here it is." .Attachments.Add PDF .Send End With Set olMail = Nothing Set olApp = Nothing End Sub
Acts 4:12
Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.
natefarm
Thanks for the information. I have now sorted the problem.
![]()
Not sure what that means, but you're welcome!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks