save PDF with two cells as reference

PEAKCAB

New Member
Joined
Jul 16, 2018
Messages
49
Morning,

Please could someone help me on the following problem? I am trying to save the pdf with two cells as the file name - F15 & A18 but i dont seem to be getting anywhere and i am a bit new to all this! :) this is what i am currently running and it works well but just missing the cell A18!

Thanks in advance

Sub SaveorderwithNewname()

Dim NewFN As Variant
PostToPurchaseOrder
'MAKEPDF Macro'
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:="Y:\Dropbox\Accounts\Accounts\PURCHASING\PURCHASE ORDERS\PURCHASE ORDERS PDF\PC00" & Range("F15")
'Copy Order to a new workbook
ActiveSheet.Copy
NewFN = "Y:\Dropbox\Accounts\Accounts\PURCHASING\PURCHASE ORDERS\PURCHASE ORDERS PDF\Excel Version\PC00" & Range("F15").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Nextorder
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I don't know if this is what you want but try this out:

VBA Code:
Sub SaveorderwithNewname()

 Dim NewFN As Variant
'MAKEPDF Macro'
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, _
Filename:="H:\TEST\New folder\" & Range("F15").Value & ".pdf" ' Change Location, don't forget the "\" at the end of location
'Copy Order to a new workbook
ActiveSheet.Copy
NewFN = "H:\TEST\New folder\" & Range("F15").Value & ".xlsx" ' Change Location, don't forget the "\" at the end of location
ActiveWorkbook.SaveAs Filename:=NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
 End Sub
 
Upvote 0
I don't know if this is what you want but try this out:

VBA Code:
Sub SaveorderwithNewname()

Dim NewFN As Variant
'MAKEPDF Macro'
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, _
Filename:="H:\TEST\New folder\" & Range("F15").Value & Range("A18").Value & ".pdf" ' Change Location, don't forget the "\" at the end of location
'Copy Order to a new workbook
NewFN = "H:\TEST\New folder\" & Range("F15").Value & Range("A18").Value & ".xlsx" ' Change Location, don't forget the "\" at the end of location
ActiveWorkbook.SaveAs Filename:=NewFN, FileFormat:=xlOpenXMLWorkbook

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top