VBA to print file in directory

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
Hi,

I need to print a file in a directory using vba. I know the file path which we can call FilePath. The difficult part is selecting the printer as the save to pdf option and selecting the destination via USB or even better skipping that dialog box all together and keeping it contained in the VBA. Is this possible?
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Upvote 0
So you're trying to save a PDF as a PDF? Couldn't you just copy the file - or are you trying to split it by only printing selected pages?
Are you using something like SendKeys to try to control your PDF reader?
 
Upvote 0
Yea what I want to do is avoid copying because that just pastes all the contents and pdf settings. Instead imagine if you have a pdf in a file directory. If you were to go to google chrome or internet explorer and paste that file directory in the browser link it would let you see that directory. Then if you select the pdf typically it will open in the browser (alternatively you could just open pdf with chrome directly by right clicking the file). If you hit print then hit save as pdf, you get a raw editable pdf . So this is what I want to automate.
 
Upvote 0
I'd advise against trying to send keystrokes - it can go wrong too easily. I suspect that you may be better using IE than Chrome, as being another MS product it should be easier to control using VBA? But you're going beyond my experience. If you don't get any other replies here, may be worth trying a forum that isn't Excel-specific, as the tricky bit of what you're trying to achieve is related to the browser application, rather than Excel.

But when you do find the answer, please post it here - I'm sure it would be useful for others searching the forums!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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