Macro buttons

M

Mike Anderson

I have several forms that I have made up. They have a control toolbox button
that is set as a macro for different functions. They all work fine but I
don't want these buttons to show when I print the document. Is there a way
to hide them or not have them show in the print?
 
M

Mike Anderson

I have tried the text box but my macro doesn't work after that. I am using
the MVP spellcheck and it works until I put it in the text box. The line
that doesn't work is this:
oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="anderson12"

It prompts me to insert = 2 after FormFields but that doesn't work
either. Any ideas on how to make it work? Or is there another way to do
this.

Thanks You
Mike
 
D

Dawn Crosier

Mike -

What version of Word are you using? Are you saying that the button
that you put inside the text box no longer works after you put it in
the Textbox or are you saying that the spell check code itself no
longer works?

I'm a little confused.

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.
 
M

Mike Anderson

The button itself works when I put the botton in the text box. But the spell
check code no longer works. It stops at this point.

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="anderson12"
 
M

Mike Anderson

sorry. running XP Pro with Office XP Pro and Office 97 Pro. not sure which
one is working.

Thanks Mike
 
D

Doug Robbins - Word MVP

Is that code all on one line in the macro? If it is as shown in your
message you need to add a visual basic carriage return (space+_) after True,

oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="anderson12"


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

Mike Anderson

No it is all on one line it just gets cut in this forum here. When I mouse
over it it prompts me to add =2 after wdAllowFormFields but that doesn't work
either.

Thanks for your help.
Mike
 
D

Doug Robbins - Word MVP

The following certainly works for me

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="test"

Are you sure that oDoc is referencing a document?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Dawn Crosier

The number 2 is referring to the value of the constant. For
compatibility it is better to refer to the constant rather than the
value, although either will work.

From Help:
WdProtectionType can be one of these WdProtectionType constants.

wdAllowOnlyComments

wdAllowOnlyFormFields

wdAllowOnlyReading

wdAllowOnlyRevisions

wdNoProtection


Regarding why your code will stop running at the protection line. Is
your document protected at that point or is it unprotected?

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.
 
M

Mike Anderson

I tried ActiveDocument instead of the oDoc and it does the same. it stops
right there.

Thank you for your help.
Mike
 
D

Doug Robbins - Word MVP

Are you sure that in your code you have wdAllowOnlyFormFields and not
wdAllowFormFields? In your post you use both.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

Mike Anderson

Yes I have wdAllowOnlyFormFields. I must have made a typo in one of my
posts. It should be noted that the macro worked fine untill I put it in the
text box.
 

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