Print PDF files from folder.

Tofik

Board Regular
Joined
Feb 4, 2021
Messages
114
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi guys, I need a VBA formula which can help me with PDF files PRINTING.

How I thing it should be ? :
1) Excel with button ( Print ) Which print all cells with numbered files.
2) Folder include reports names : 12763-12764_AZF-CS-4004 and in excel I write only AZF-CS-4004. Is it possible to Print in this way or I should write all the file name like 12763-12764_AZF-CS-4004 ?
3) Print sequence to avoid manual sorting printed papers.

1666847603513.png

1666847495153.png
 
The error occurs because Set Sh = CreateObject("Shell.Application") failed and therefore the Sh object is undefined (Nothing), probably because your account doesn't have the required permissions to access the Windows shell.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
The error occurs because Set Sh = CreateObject("Shell.Application") failed and therefore the Sh object is undefined (Nothing), probably because your account doesn't have the required permissions to access the Windows shell.
how can i fix that?
 
Upvote 0
First, step through the code with F8 to confirm my theory. If I'm correct, you would need to set the permissions. Also check that what I said in post #5 is true for you:

This macro should work, as long as Print is shown in the context menu when you right-click on a PDF file in File Explorer, because it uses the Shell32 object.
 
Upvote 0
First, step through the code with F8 to confirm my theory. If I'm correct, you would need to set the permissions. Also check that what I said in post #5 is true for you:
i tried with F8 too, so i found the blockage, i also can't try that third step you gave until i solve the error
 
Upvote 0
Checking the 'third step' is simply you manually interacting with the File Explorer UI and nothing to do with the VBA error or Excel.
 
Upvote 0
unfortunately i couldn't find anything about spooling on my printer's properties
 
Upvote 0
If you have Win11 it might not show you the print button option when you right click on the file. To fix that you can do this:
Command Prompt Shortcut to Create the Required Registry to Enable ‘Show more options’ by Default
open the Command Prompt -> select ‘Run as Administrator’
So click Start button and type cmd then when it shows up right click it and select ‘Run as Administrator’ then paste this line into the black screen
Bash:
reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /d "" /f

If you wanna undo that and go back to the default Win11 right-click options, you can use this:
Bash:
reg.exe delete “HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}” /f
 
Upvote 0

Forum statistics

Threads
1,223,941
Messages
6,175,535
Members
452,652
Latest member
eduedu

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