nathandavies
04-11-2018, 05:30 AM
Hi all,
I have created a macro to PDF a hidden page using a macro, but i want to use cells within the workbook to save the pdf in the correct location and with the correct title, i have tried this code but it seems to crash on the file name lien every time.
i have attached my code for the reference.
Thanks in advance.
Sub Macro4()' Macro4 Macro
ProjectRootFolder = Sheets("RootFolder").Range("B5").Value
JobNumber = Sheets("Summary").Range("CJobNumber").Value
CSiteName = Sheets("Summary").Range("CSiteName").Value
CCompanyName = Sheets("Summary").Range("CCompanyName").Value
CVaritationNumber1 = Sheets("Summary").Range("CVaritationNumber1").Value
Range("AB49:AD49").Select
ActiveCell.FormulaR1C1 = "PDF Quote 1"
Sheets("Variation Quote 1").Visible = True
Sheets("Variation Quote 1").Select
Range("A1:K62").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
ProjectRootFolder \ CCompanyName \ JobNumber & " " & CSiteName \ CVaritationNumber1.pdf _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("Variation Quote 1").Visible = False
Sheets("Summary").Se
I have created a macro to PDF a hidden page using a macro, but i want to use cells within the workbook to save the pdf in the correct location and with the correct title, i have tried this code but it seems to crash on the file name lien every time.
i have attached my code for the reference.
Thanks in advance.
Sub Macro4()' Macro4 Macro
ProjectRootFolder = Sheets("RootFolder").Range("B5").Value
JobNumber = Sheets("Summary").Range("CJobNumber").Value
CSiteName = Sheets("Summary").Range("CSiteName").Value
CCompanyName = Sheets("Summary").Range("CCompanyName").Value
CVaritationNumber1 = Sheets("Summary").Range("CVaritationNumber1").Value
Range("AB49:AD49").Select
ActiveCell.FormulaR1C1 = "PDF Quote 1"
Sheets("Variation Quote 1").Visible = True
Sheets("Variation Quote 1").Select
Range("A1:K62").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
ProjectRootFolder \ CCompanyName \ JobNumber & " " & CSiteName \ CVaritationNumber1.pdf _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("Variation Quote 1").Visible = False
Sheets("Summary").Se