Word Macro runs then gets Macro Not Found 
Author Message
 Word Macro runs then gets Macro Not Found

Hi John,

| Astrid... thanks for the suggestion.  I thought about that too, and had
| tried renaming it Protect2, Protect3, and finally NoChgs, but they all do
| the same thing.

Can you post back with the code of your macro so we can see if it's
something in there?

| Answered in microsoft.public.office.developer.vba.
| Thanks... I appreciate that you provided the info.  I'm new to MS
| newsgroups,
| so I probably messed it up.  Which of the groups would you have posted it
to
| based on the question?  Thanks, John

I prefer to ask the question to the most relevant group. In this situation
your question is about Word so if I posted it, it would be in one of the
Word newsgroups (I send this reply to both microsoft.public.office.developer
as to microsoft.public.word.vba.beginners). If the question was about
programming Outlook from Word maybe I would crosspost to a Word and an
Outlook group for example.
There are some tips on using newsgroups at
www.mvps.org/word/FindHelp/index.html

Hope this helps,
regards,
Astrid

Please post replies to the newsgroup so that other readers can contribute or
benefit.

Visit the MVP Word FAQ site at http://www.*-*-*.com/
For direct access to all Microsoft newsgroups:



Quote:
> Hi John,

> I bet it's the name of your macro. Is it called Protect? I think this name
> is reserved for Word itself. Does the macro run well when your rename it?

> Hope this helps,
> regards,
> Astrid

> Please post replies to the newsgroup so that other readers can contribute
or
> benefit.

> Visit the MVP Word FAQ site at http://www.*-*-*.com/
> For direct access to all Microsoft newsgroups:



> > I'm new to macros in Office, but I have a Word macro that protects a
> > document for Forms.  It runs (because afterwards the doc is protected)
but
> > then it gets an error saying that my macro wasn't found.

> > I even set a breakpoint in the macro and the code stopped at the
> > breakpoint -- and I was able to single step through it.  All
instructions
> > worked and when I executed the "Exit sub" then that's when I got Macro
Not
> > Found.

> > Is the problem that macros cannot be executed from a Protected document?
> If
> > so, any suggestions on how to autoprotect the document (it's a legal
> > contract so protection is required)?

> > Thanks, John



Mon, 09 Jun 2003 04:36:13 GMT  
 Word Macro runs then gets Macro Not Found
Here is the code I'm trying to run...

Sub NoChgs()
'
' NoChgs Macro
' Macro recorded 19 December 2000 by John Haver
'
    ActiveDocument.Sections(1).ProtectedForForms = True
    ActiveDocument.Sections(2).ProtectedForForms = True
    ActiveDocument.Sections(3).ProtectedForForms = True
    ActiveDocument.Sections(4).ProtectedForForms = True
    ActiveDocument.Sections(5).ProtectedForForms = True
    ActiveDocument.Sections(6).ProtectedForForms = True
    ActiveDocument.Sections(7).ProtectedForForms = True
    ActiveDocument.Sections(8).ProtectedForForms = True
    ActiveDocument.Sections(9).ProtectedForForms = True
    ActiveDocument.Sections(10).ProtectedForForms = True
    ActiveDocument.Sections(11).ProtectedForForms = True
    ActiveDocument.Protect Password:="SOMEPASSWORD", NoReset:=False, Type:=
_
        wdAllowOnlyFormFields
    ActiveDocument.Save
End Sub

Thanks, John


Quote:
> Hi John,

> | Astrid... thanks for the suggestion.  I thought about that too, and had
> | tried renaming it Protect2, Protect3, and finally NoChgs, but they all
do
> | the same thing.

> Can you post back with the code of your macro so we can see if it's
> something in there?

> | Answered in microsoft.public.office.developer.vba.
> | Thanks... I appreciate that you provided the info.  I'm new to MS
> | newsgroups,
> | so I probably messed it up.  Which of the groups would you have posted
it
> to
> | based on the question?  Thanks, John

> I prefer to ask the question to the most relevant group. In this situation
> your question is about Word so if I posted it, it would be in one of the
> Word newsgroups (I send this reply to both

microsoft.public.office.developer

- Show quoted text -

Quote:
> as to microsoft.public.word.vba.beginners). If the question was about
> programming Outlook from Word maybe I would crosspost to a Word and an
> Outlook group for example.
> There are some tips on using newsgroups at
> www.mvps.org/word/FindHelp/index.html

> Hope this helps,
> regards,
> Astrid

> Please post replies to the newsgroup so that other readers can contribute
or
> benefit.

> Visit the MVP Word FAQ site at http://www.mvps.org/word/
> For direct access to all Microsoft newsgroups:



> > Hi John,

> > I bet it's the name of your macro. Is it called Protect? I think this
name
> > is reserved for Word itself. Does the macro run well when your rename
it?

> > Hope this helps,
> > regards,
> > Astrid

> > Please post replies to the newsgroup so that other readers can
contribute
> or
> > benefit.

> > Visit the MVP Word FAQ site at http://www.mvps.org/word/
> > For direct access to all Microsoft newsgroups:



> > > I'm new to macros in Office, but I have a Word macro that protects a
> > > document for Forms.  It runs (because afterwards the doc is protected)
> but
> > > then it gets an error saying that my macro wasn't found.

> > > I even set a breakpoint in the macro and the code stopped at the
> > > breakpoint -- and I was able to single step through it.  All
> instructions
> > > worked and when I executed the "Exit sub" then that's when I got Macro
> Not
> > > Found.

> > > Is the problem that macros cannot be executed from a Protected
document?
> > If
> > > so, any suggestions on how to autoprotect the document (it's a legal
> > > contract so protection is required)?

> > > Thanks, John



Sat, 14 Jun 2003 21:12:28 GMT  
 Word Macro runs then gets Macro Not Found
Hi John,

Thanks for the code. I've tried it but it works fine. At least under some
circomstainces. Do you have trouble when you execute the macro for the
second time?
It works when the document is unprotected but won't work if the file is
protected since you can't set the property .ProtectedForForms for each
section if the document is already protected (if you really need to do that
you would have to unprotect it first)
I don't really understand why you need to set the .ProtectedForForms
property anyway. Are there also sections in the document that are
unprotected? If not, I think this code does the exact same thing:
----------------------------------------------------
    If ActiveDocument.ProtectionType = wdNoProtection Then
      ActiveDocument.Protect Password:="SOMEPASSWORD", _
      NoReset:=False, Type:=wdAllowOnlyFormFields
      ActiveDocument.Save
    End If
----------------------------------------------------

If your problem  is that you can't run the macro from the Tools-Macro-Macros
list when the file is protected, you can add a button to the toolbar to run
it since you can't run a macro like that in a protected form. That's by
design in Word ;-)

Hope this helps,
regards,
Astrid

Please post replies to the newsgroup so that other readers can contribute or
benefit.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Here is the code I'm trying to run...

> Sub NoChgs()
> '
> ' NoChgs Macro
> ' Macro recorded 19 December 2000 by John Haver
> '
>     ActiveDocument.Sections(1).ProtectedForForms = True
>     ActiveDocument.Sections(2).ProtectedForForms = True
>     ActiveDocument.Sections(3).ProtectedForForms = True
>     ActiveDocument.Sections(4).ProtectedForForms = True
>     ActiveDocument.Sections(5).ProtectedForForms = True
>     ActiveDocument.Sections(6).ProtectedForForms = True
>     ActiveDocument.Sections(7).ProtectedForForms = True
>     ActiveDocument.Sections(8).ProtectedForForms = True
>     ActiveDocument.Sections(9).ProtectedForForms = True
>     ActiveDocument.Sections(10).ProtectedForForms = True
>     ActiveDocument.Sections(11).ProtectedForForms = True
>     ActiveDocument.Protect Password:="SOMEPASSWORD", NoReset:=False,
Type:=
> _
>         wdAllowOnlyFormFields
>     ActiveDocument.Save
> End Sub

> Thanks, John



> > Hi John,

> > | Astrid... thanks for the suggestion.  I thought about that too, and
had
> > | tried renaming it Protect2, Protect3, and finally NoChgs, but they all
> do
> > | the same thing.

> > Can you post back with the code of your macro so we can see if it's
> > something in there?

> > | Answered in microsoft.public.office.developer.vba.
> > | Thanks... I appreciate that you provided the info.  I'm new to MS
> > | newsgroups,
> > | so I probably messed it up.  Which of the groups would you have posted
> it
> > to
> > | based on the question?  Thanks, John

> > I prefer to ask the question to the most relevant group. In this
situation
> > your question is about Word so if I posted it, it would be in one of the
> > Word newsgroups (I send this reply to both
> microsoft.public.office.developer
> > as to microsoft.public.word.vba.beginners). If the question was about
> > programming Outlook from Word maybe I would crosspost to a Word and an
> > Outlook group for example.
> > There are some tips on using newsgroups at
> > www.mvps.org/word/FindHelp/index.html

> > Hope this helps,
> > regards,
> > Astrid

> > Please post replies to the newsgroup so that other readers can
contribute
> or
> > benefit.

> > Visit the MVP Word FAQ site at http://www.mvps.org/word/
> > For direct access to all Microsoft newsgroups:



> > > Hi John,

> > > I bet it's the name of your macro. Is it called Protect? I think this
> name
> > > is reserved for Word itself. Does the macro run well when your rename
> it?

> > > Hope this helps,
> > > regards,
> > > Astrid

> > > Please post replies to the newsgroup so that other readers can
> contribute
> > or
> > > benefit.

> > > Visit the MVP Word FAQ site at http://www.mvps.org/word/
> > > For direct access to all Microsoft newsgroups:



> > > > I'm new to macros in Office, but I have a Word macro that protects a
> > > > document for Forms.  It runs (because afterwards the doc is
protected)
> > but
> > > > then it gets an error saying that my macro wasn't found.

> > > > I even set a breakpoint in the macro and the code stopped at the
> > > > breakpoint -- and I was able to single step through it.  All
> > instructions
> > > > worked and when I executed the "Exit sub" then that's when I got
Macro
> > Not
> > > > Found.

> > > > Is the problem that macros cannot be executed from a Protected
> document?
> > > If
> > > > so, any suggestions on how to autoprotect the document (it's a legal
> > > > contract so protection is required)?

> > > > Thanks, John



Sun, 15 Jun 2003 20:34:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Word Macro runs then gets Macro Not Found

2. Macros in Excel: How do I avoid getting confirmation windows when I run the macro

3. WORD X: VBA macro including find/replace with styles much slower than regular macro

4. Running a word Macro & an excel macro

5. DLL not found when macro run under win2000 but works under NT4

6. Word 97 Macros > Word XP Macros

7. Word Protect from macro getting "Macro not found"

8. My Word 97 macros don't run in Word 2000

9. Word 2000 macro running under Word 97

10. Word 97/how to delete a macro by a macro

11. I need vc ide macro help, trying to create a move to end of word macro

12. I'd like to use word with all macros disabled *and* without getting annoying msg

 

 
Powered by phpBB® Forum Software