🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 07-08-2021 12:10 PM
(1758 views)
Hi Everyone,
I have an invoice in Excel sheet with graphic and table.
I wonder if SAS can help to print that Excel page into PDF.
The outcome is just like we use Save As PDF in Excel.
Thanks,
HHC
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would recommend using ODS PDF if you can...if you cannot, use VBS.
https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1
Change this line
mybook.SaveAs ""&default.\"" & Filename & "".xlsx"", 51";
to
mybook.SaveAs ""&default.\"" & Filename & "".pdf"", 51";
You'll need to figure out what that 51 should be - I can't seem to find it easily but it's out there somewhere.
It's not listed here which is where I'd usually find it, but I'm fairly certain I've done this before. https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat
https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1
Change this line
mybook.SaveAs ""&default.\"" & Filename & "".xlsx"", 51";
to
mybook.SaveAs ""&default.\"" & Filename & "".pdf"", 51";
You'll need to figure out what that 51 should be - I can't seem to find it easily but it's out there somewhere.
It's not listed here which is where I'd usually find it, but I'm fairly certain I've done this before. https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Why use SAS here? Excel can save as PDF.
--
Paige Miller
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would recommend using ODS PDF if you can...if you cannot, use VBS.
https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1
Change this line
mybook.SaveAs ""&default.\"" & Filename & "".xlsx"", 51";
to
mybook.SaveAs ""&default.\"" & Filename & "".pdf"", 51";
You'll need to figure out what that 51 should be - I can't seem to find it easily but it's out there somewhere.
It's not listed here which is where I'd usually find it, but I'm fairly certain I've done this before. https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat
https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1
Change this line
mybook.SaveAs ""&default.\"" & Filename & "".xlsx"", 51";
to
mybook.SaveAs ""&default.\"" & Filename & "".pdf"", 51";
You'll need to figure out what that 51 should be - I can't seem to find it easily but it's out there somewhere.
It's not listed here which is where I'd usually find it, but I'm fairly certain I've done this before. https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat