PDA

View Full Version : VBA Checkbox buttons



CodesiriuS
12-19-2016, 04:41 PM
Hello - I have a userform with two command buttons and three check boxes -
The first command button gets a file and drops it in a textbox -
Then I have three Check boxes (all formatting related)
My Question is surrounding my command button 2 "Process File" I was hoping the user would select this button and then based on whether the checkbox is checked will run the macros associated with the check boxes selected - I get a error at the application. Run
Does anybody know why this isn't working?


Private Sub CommandButton2_Click()
If CheckBox1.Value = True Then
Application.Run
Else
End If
CheckBox1.Value = False
If CheckBox2.Value = True Then
Application.Run
Else
End If
CheckBox1.Value = False

Kenneth Hobs
12-19-2016, 05:32 PM
Press F1 with cursor in or next to a command word to get specif help. As such, you can see the syntax that you did not supply the input required for that command. That command is usually meant to run a macro in another workbook. Was that your intent?

Normally, would would just Call the macro to run if it is in a Module or in that userform. e.g.

MySuperDuperMacro

CodesiriuS
12-19-2016, 05:55 PM
Thanks thats a cool trick!!
I used:
Application.Run "module1.ClearFormatting"

Kenneth Hobs
12-19-2016, 06:06 PM
Is it not sufficient to just call it?

ClearFormatting

CodesiriuS
12-19-2016, 06:26 PM
Good point