VBA-E: Unable to Print PDF
Solved
sifusalade
Posted messages
142
Status
Member
-
sifusalade Posted messages 142 Status Member -
sifusalade Posted messages 142 Status Member -
Bonjour,
I would like to understand why I cannot print a PDF file with the code:
whereas for my test procedure, if I put this:
or even
it works. I want to emphasize that all these test files are present, including the PDF.
I am using Excel 2010.
Do I need a specific PDF reader? I don’t have Acrobat Reader, is that the reason? I use Sumatra PDF Portable. But I tested by setting Edge as the default PDF reader, and it still doesn’t work, even with Edge. It’s strange that there are no issues with other types of files.
If anyone knows why, I would appreciate the information.
Thank you.
I would like to understand why I cannot print a PDF file with the code:
Sub PrintFile(File As String) CreateObject("Shell.Application").Namespace(0).ParseName(File).InvokeVerb("Print") End Sub Sub test() Call PrintFile("D:\test.pdf") End Sub whereas for my test procedure, if I put this:
Sub test() Call PrintFile("D:\test.png") End Sub or even
Sub test() Call PrintFile("D:\test.docx") End Sub it works. I want to emphasize that all these test files are present, including the PDF.
I am using Excel 2010.
Do I need a specific PDF reader? I don’t have Acrobat Reader, is that the reason? I use Sumatra PDF Portable. But I tested by setting Edge as the default PDF reader, and it still doesn’t work, even with Edge. It’s strange that there are no issues with other types of files.
If anyone knows why, I would appreciate the information.
Thank you.
7 answers
-
Hello,
At my place, it prints PDF file. Do you have an error? -
Hello,
The code works for me too..... with Adobe Acrobat XI Pro
Regards -
Good evening,
Personally, I would say that a portable version does not install all the files where they need to be... so in the installed version, I'm pretty sure it would work, but that's just my opinion.
Best regards -
Hello,
It's very strange. Nothing is happening on my end. No error message. I even tried placing a MsgBox at the end of the test() procedure and that MsgBox displayed correctly. Only the PDF printing is not starting. -
Hello,
Thank you. The more time goes by, the more I think that Acrobat Reader is essential.
Is there a universal solution? -
With Sumatra PDF in portable version. But as I said, I also tried to set Edge as the default reader. But whether it's with Sumatra PDF or Edge, the printing doesn't start.
-
Thank you. I thought the same thing. That's why I tried with Edge. Too bad, I will try to install Sumatra PDF. I don't like to install too many things on my computer. The less I have, the better it is. So as soon as I have portable versions, I take them. Too bad, I will install it and try again.
I will come back to give the result of the test. Thank you.
EDIT:
I installed Sumatra PDF and it works now. This answers two questions:
- Is Acrobat Reader absolutely necessary? Answer = No
- Is it absolutely necessary to have a PDF reader installed? Answer = Yes, a portable version is not enough.