Print using a userform

sew07

New Member
Joined
Aug 10, 2019
Messages
10
Hi all,

I have been searching for a code to print files from a company server (shared folder) but I can't get any working.

On the userform I would like to have two comboboxes and a listbox. The first combobox would be populated by subfolders within a folder named "Projects" (which is saved on the company server). The second combobox to select a subfolder within the folder selected in the first combobox. Once a folder is selected the listbox would then be populated with the files within the selected folder from the second combobox which are usually all pdf's.

Once all the pdf's are shown in the listbox I can then select all or select multiple files and click a print button.

Could anyone share a code they have came across for this or write a code for me that would work. I have tried myself but could not get anything working as I am new to vba.

Thanks
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Do you have code for printing a PDF?
 
Upvote 0
I don't have any codes that work the way I want them to

Code:
Private Sub UserForm_Initialize()
Dim FD As FileDialog
Set FD = Application.FileDialog(msoFileDialogFolderPicker)

If FD.Show = -1 Then
Folder_path = FD.SelectedItems(1)
Filename = Dir(Folder_path & "\*.pdf", vbNormal) '.doc,.pdf etc

Do While Len(Filename) > 0
UserForm7.ListBox1.AddItem Filename
Filename = Dir()
Loop

End If

End Sub

This code populates the listbox on the userform with pdf's from a saved folder

I have a command button for printing. I would like to be able to select multiple pdf's from the listbox and click print
 
Upvote 0
Hi,

I created Print Command Button in Userform but it does not show printer options. Anyone can help me?
Tnx.
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,176
Members
448,554
Latest member
Gleisner2

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