Usin VBA code to save to pdf and xlsm

gabl136

New Member
Joined
Oct 24, 2018
Messages
6
Hello everybody!

I am having trouble saving my quotations to to xlsm and pdf at the same time. I've figured out how to save to xlsx & pdf, but I can't figure out the code on myself.


I use this code to save to xlsx & pdf:

Sub SaveInvoiceBothWays()
Dim NewFN As Variant
' Create the PDF First
NewFN = "D:\GM PRO d.o.o\Dokumenti" & Range("A15").Value & " " & Range("D15").Value & Range("E15").Value & Range("F15").Value & " " & Range("A9").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
' Next, Save the Excel File
Sheets.Copy
NewFN = "D:\GM PRO d.o.o\Dokumenti" & Range("A15").Value & " " & Range("D15").Value & Range("E15").Value & Range("F15").Value & " " & Range("A9").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
End Sub




I want to get this working so I can convert my quotations to Invoices..

Any help will be greatly appreciated.


All the best, Gabl136
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
hey, sorry for buggin' you, I just figured it out. Just have to use FileFormat:=52 :D

Thy anyway :D
 
Upvote 0
Code:
..., FileFormat:=xlOpenXMLWorkbookMacroEnabled
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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