VBA_Command Buttons with Form

  • Thread starter jer99 via OfficeKB.com
  • Start date
J

jer99 via OfficeKB.com

I've been programming in Access VBA for quite a few years and am branching
out to Word (smile).
I've designed a 3 page form in word (2003 SP2). I am also new to forms.

I thought it would be a good idea if I had a submit button on the bottom of
the form and when pressed, save it and also send the parsed data to another
directory.

I can figure out the code for the process if I can only get the button to
work!!!
I have a statement on the click event like:

if msgbox("Are you sure you are finished?",......) = vbok then
do something
endif

I put a break on the do something line.
When I click on the button, nothing happens. I took it out of design mode
(I'm pretty sure) and even tried to protect it to only filling out the form.

I'm sure there is a very basic answer (no pun intended) here. I'm just
missing it.
Thanks.
 
J

Jean-Guy Marcil

jer99 via OfficeKB.com was telling us:
jer99 via OfficeKB.com nous racontait que :
I've been programming in Access VBA for quite a few years and am
branching out to Word (smile).
I've designed a 3 page form in word (2003 SP2). I am also new to
forms.

I thought it would be a good idea if I had a submit button on the
bottom of the form and when pressed, save it and also send the parsed
data to another directory.

I can figure out the code for the process if I can only get the
button to work!!!
I have a statement on the click event like:

if msgbox("Are you sure you are finished?",......) = vbok then
do something
endif

I put a break on the do something line.
When I click on the button, nothing happens. I took it out of design
mode (I'm pretty sure) and even tried to protect it to only filling
out the form.

I'm sure there is a very basic answer (no pun intended) here. I'm just
missing it.
Thanks.

Can you post the exact code and the sub name you are using? Where is this
sub located?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

jer99 via OfficeKB.com

The exact code is:

Private Sub cmdFinal_Click()
If MsgBox("Are you sure you have finalized the form and wish to submit?",
vbOKCancel, "Trivantage Analysis Request Form Finalization") = vbOK Then

Else
saveform
End If

End Sub

I placed it in the Microsoft Word Objects in the click event of the button.
The problem is that the button doesn't "click".
I think it has something to do with the way I set up the form.
I take it out of design mode and protect it for everything but filling in the
form.
 
J

Jean-Guy Marcil

jer99 via OfficeKB.com was telling us:
jer99 via OfficeKB.com nous racontait que :
The exact code is:

Private Sub cmdFinal_Click()
If MsgBox("Are you sure you have finalized the form and wish to
submit?", vbOKCancel, "Trivantage Analysis Request Form
Finalization") = vbOK Then

Else
saveform
End If

End Sub

I placed it in the Microsoft Word Objects in the click event of the
button. The problem is that the button doesn't "click".
I think it has something to do with the way I set up the form.
I take it out of design mode and protect it for everything but
filling in the form.

What Word version?
If leave design mode and then protect the from, the button should click.
Are you sure you named the button "cmdFinal" when in design mode
(right-click on the button and select "Properties")?

When you click on it, does it appear to be depressed, but nothing happens?
Or it does not even react?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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