Thread: [Solved] EXCEL 2007 - Create PDF
View Single Post
 
Old 01-02-2023, 05:55 PM
psyclone psyclone is offline Windows 10 Office 2007
Novice
 
Join Date: Jan 2023
Posts: 3
psyclone is on a distinguished road
Default EXCEL 2007 - Create PDF

Hello,
I have Excel 2007, get an error when running the following code to create PFD. I can save the exact code and run it on Office360 no problem.
I'm interested to know if it's my '07' version or does my machine require an Add-in to run it?

Also, apologies regarding my post description, I posted accidentally before completing.

'-------------------------------------------------
Sub CreatePDF()

Worksheets("SCHEDULES").Activate

Dim dte As String
Dim Adr As String
Dim IDw As String
Dim path As String
Dim fname As String
dte = Range("H3").Text
Adr = Range("G2").Text


IDw = Format(dte, "medium Date")


path = "C:\Users\.....\....."
fname = Adr & ", " & IDw & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=path & fname, _
IgnorePrintAreas:=False ' ,_
' OpenAfterPublish:=False


End Sub

'-----------------------------------------------

Last edited by psyclone; 01-02-2023 at 06:04 PM. Reason: Posted accidentally before completion
Reply With Quote