Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

A very visually basic question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wallace - 16 Feb 2006 18:58 GMT
I want to put a macro in a template I have (Word 2003). I open the template
and go to Tools>Macros>Record Macro. I assign the macro a name and tell Word
I want to store it in this template. Then I record the macro. I save and
close the template.

I open a new document from that template and sure enough, there's the text
of my macro, just as I typed it. It doesn't do anything — it just sits there
in the template, for all the world to see.

What (or should I say how many things) have I done wrong?

Signature

Wallace

Charles Kenyon - 16 Feb 2006 19:09 GMT
First, don't use macros for repeating text. Its the wrong tool. Use AutoText
or AutoCorrect.

It sounds like you saved your template with the text showing. When you
create a new document based on a template, it will show whatever text is in
the template.

http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm
http://word.mvps.org/FAQs/Customization/AutoCorrect.htm
http://word.mvps.org/FAQs/Customization/AutoText.htm

For more on the different kinds of templates, tabs on the file new dialog,
and locations of templates folders see
http://addbalance.com/usersguide/templates.htm.

I suspect that you have moved from Word Perfect, where macros are used to
repeat text. If so and if you would like some suggestions on making Word
easier to use, reply back.
Signature


Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

>I want to put a macro in a template I have (Word 2003). I open the template
> and go to Tools>Macros>Record Macro. I assign the macro a name and tell
[quoted text clipped - 8 lines]
>
> What (or should I say how many things) have I done wrong?
Tony Jollans - 16 Feb 2006 19:29 GMT
Nothing in your description of what you have done mentions typing anything
so what do you mean when you say that the text of your macro is "just as I
typed it"?

--
Enjoy,
Tony

> I want to put a macro in a template I have (Word 2003). I open the template
> and go to Tools>Macros>Record Macro. I assign the macro a name and tell Word
[quoted text clipped - 3 lines]
> I open a new document from that template and sure enough, there's the text
> of my macro, just as I typed it. It doesn't do anything - it just sits
there
> in the template, for all the world to see.
>
> What (or should I say how many things) have I done wrong?
>
> --
> Wallace
Wallace - 17 Feb 2006 14:31 GMT
Okay, here is what I want to do. I want to create a template from which
documents will open to Track Changes "Final" rather than "Final Showing
Markup."
I have attempted to load this simple macro into the template:

Sub AutoOpen()
'Change Tracked Changes to Final View
    With ActiveWindow.View
         .ShowRevisionsAndComments = False
         .RevisionsView = wdRevisionsViewFinal
    End With
End Sub

As I mentioned, now when I open a document based on this template, the text
of the macro appears, but the Display for Review Window still shows "Final
Showing Markup."

So I need to have the macro *execute* when the document opens, not sit there
in the document itself, staring me in the face! Of course, when I go to the
macros library and run this macro from there, it works. But what's the point
of that? I can do the same thing by clicking the down arrow and changing the
view in the Track Changes window.

Anyway, that's my problem, and I appreciate those of you who have offered
suggestions.
Signature

Wallace

> Nothing in your description of what you have done mentions typing anything
> so what do you mean when you say that the text of your macro is "just as I
[quoted text clipped - 20 lines]
> > --
> > Wallace
Tony Jollans - 17 Feb 2006 17:18 GMT
Such a macro ought to work. Where have you put it?

I'm rather confused by what you say (that it is in the document) but you
mention that you recorded it so it should be in a module (probably
"NewMacros") in your template - or is it in Normal.dot?

--
Enjoy,
Tony

> Okay, here is what I want to do. I want to create a template from which
> documents will open to Track Changes "Final" rather than "Final Showing
[quoted text clipped - 48 lines]
> > > --
> > > Wallace
Wallace - 17 Feb 2006 18:11 GMT
Tony:

It's in Normal.dot.

But now I have a new problem. When I attempt to run it, I get error message
#91: "Object variable or With block variable not set." I thought the With ...
End With block was properly defined, but VBA seems to disagree.  
Signature

Wallace

> Such a macro ought to work. Where have you put it?
>
[quoted text clipped - 68 lines]
> > > > --
> > > > Wallace
Tony Jollans - 17 Feb 2006 19:36 GMT
If you want it to run when documents based on a particular template are
opened, it must be in that template. If it's in Normal it will run when
documents based on Normal are opened - not documents based on other
templates.

Create a new module in your template and move the code into that.

Not sure about your error - did you have a document open at the time?

--
Enjoy,
Tony

> Tony:
>
[quoted text clipped - 78 lines]
> > > > > --
> > > > > Wallace
Barry Schwarz - 18 Feb 2006 05:49 GMT
>I want to put a macro in a template I have (Word 2003). I open the template
>and go to Tools>Macros>Record Macro. I assign the macro a name and tell Word
[quoted text clipped - 6 lines]
>
>What (or should I say how many things) have I done wrong?

I think you need to create a template, open a DOCUMENT from that
template, and then record your macro and save it in the template.

Remove del for email
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.