Checkbox in an If statement

J

JuanManuel

Upon saving, I'm trying to show a messagebox when none of the 4 checkboxes in
the document are checked and to cancel saving.

I'm using checkboxes from the control toolbox.

It's giving me an error on the If statement called: Run-time error '424".
Object required.

This is the code that I'm using:

Sub FileSaveAll()
If ChkboxTMS1.Value = False And ChkboxTMS2.Value = False And
ChkboxTMS3.Value = False And ChkboxTMS4.Value = False Then
MsgBox "Please select a radiobutton and retype your changes."
Exit Sub
Else Documents.Save
End If
End Sub

Any thoughts?

Thank you
 
C

Cindy M.

Hi JuanManuel,
Upon saving, I'm trying to show a messagebox when none of the 4 checkboxes in
the document are checked and to cancel saving.

I'm using checkboxes from the control toolbox.

It's giving me an error on the If statement called: Run-time error '424".
Object required.
In which module is this code located? I think, the way it's set up, it would
have to be in the ThisDocument module to access the activeX controls in this
manner.
This is the code that I'm using:

Sub FileSaveAll()
If ChkboxTMS1.Value = False And ChkboxTMS2.Value = False And
ChkboxTMS3.Value = False And ChkboxTMS4.Value = False Then
MsgBox "Please select a radiobutton and retype your changes."
Exit Sub
Else Documents.Save
End If
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top