Macro to save excel file as pdf and xlsm

cal024

New Member
Joined
Jul 28, 2010
Messages
1
Hi,
I have a macro that saves an excel sheet as a pdf and names the pdf based on cell contents as below.

Sub SPO()
'
' SPO Macro
'
Dim OrdName As String
Dim OrdNumb As Integer
OrdName = Sheets("PO FORM").Range("B8").Text
OrdNumb = Sheets("PO FORM").Range("H2").Text
SaveFileAs.Filename = "H:\Production\ORDERS\" & OrdName & "G0" & OrdNumb & ".pdf"
SendKeys Filename & "{ENTER}", False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"CutePDF Writer on CPW2:", Collate:=True
End Sub

I would like then to save active worksheet as the original excel sheet in the original folder. I have been unsuccessful as I can only get it to save in original folder as pdf not excel.
Any ideas would be greatly appreciated

Regards
Chris
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,524
Messages
6,120,049
Members
448,940
Latest member
mdusw

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