UserForm with Checkboxes to grab PDFs and combine

zohebnoorani

New Member
Joined
Jun 25, 2018
Messages
2
I am not sure if this is possible, but it seems like theoretically it could be done. I am trying to create a Macro that pops up a userform with a list of courses. Once the user has selected the relevant courses and started the generation process, I would like for the code to be able to first see which courses were selected and then go get the corresponding courses and combine them into a single PDF saved on the computer.

I currently have a UserForm with a few test courses and a code that will display the form and allow the user to select courses. As of right now once the courses are selected and the generation button is clicked the code shows a message box with the name of the course selected in individual message boxes (just to verify it is reading the checkboxes). The problem I am having is trying to have the checkboxes correspond to a file path. Then to have it keep a list of the files that need to be merged.

I have already seen some help on how to use VBA and Microsoft Print to PDF.

Below is the code that I currently have.

Code:
Private Sub CourseSelector_Initialize()

End Sub


Private Sub Build_Click()


Dim C As MSForms.Control
    For Each C In Me.Controls '<--| loop through userform controls
        If TypeName(C) = "CheckBox" Then
        If C.Value = True Then
        
            MsgBox C.Caption
            End If
        End If
    Next C


End Sub

Code:
Sub Butt*******()
    CourseSelector.Show
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
.
If you have more than a few courses to be selected by the user, I would suggest not using the FORM approach unless you don't mind have a very, very large form for them to scroll down through.

It would be 'cleaner' looking to have it all of a worksheet, and use perhaps a checkbox next to each course listed. The user could click the appropriate checkboxes.

When they are done selecting, use a Command Button to write the selections to a separate sheet, one row below the other, then create a PDF from that sheet.


If you have only a few courses to choose from, using the FORM would be a good presentation and you would continue with the remainder of the project as though you were using the worksheet described above.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
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