AutoNew Macro converted from Word Basic won't run

L

Lesley Regan

Hello, everyone. I have been searching for explanations online and in the
newsgroups, and have lots of pieces of information I can't quite fit
together, so apologies if explanations are plainly stated somewhere:

My system's Word version is XP. I have some inherited templates with
AutoNew macros that have converted to VB-compatible WordBasic commands upon
opening the templates and saving them in WordXP. The typical AutoNew macro
is now named Public Sub Main () within a Module named AutoNew that's in the
template.

Factors:
1. I inherited some old Word templates which are form documents with fields
to fill in. Users are prompted to supply values for each field with a prompt
supplied in the field code. There is no separate user form as such that is
part of the template.
2. An AutoNew macro is contained in a module in each template.
3. Upon creating a new document from a template, the autonew macro does not
run.
4. The VB Editor Project Explorer shows there's a Reference to Normal in
the template. (This is definitely the template, not the New Document). My
experience has been that a reference to normal results from abnormal closing
of word, or some other error, and causes problems in the template. I cannot
remove the Reference to Normal by unchecking the appropriate box.

Can anyone explain how to fix these templates so AutoNew runs?
How can I remove the reference to Normal?

Even if the result is that I have to create new templates, it would be
interesting to know what's behind the two issues I've described.

Thanks for any insights you might be able to offer about these issues,

Lesley --
 
L

Lesley Regan

Lesley said:
Hello, everyone. I have been searching for explanations online and in the
newsgroups, and have lots of pieces of information I can't quite fit
together, so apologies if explanations are plainly stated somewhere:

My system's Word version is XP. I have some inherited templates with
AutoNew macros that have converted to VB-compatible WordBasic commands upon
opening the templates and saving them in WordXP. The typical AutoNew macro
is now named Public Sub Main () within a Module named AutoNew that's in the
template.

Factors:
1. I inherited some old Word templates which are form documents with fields
to fill in. Users are prompted to supply values for each field with a prompt
supplied in the field code. There is no separate user form as such that is
part of the template.
2. An AutoNew macro is contained in a module in each template.
3. Upon creating a new document from a template, the autonew macro does not
run.
4. The VB Editor Project Explorer shows there's a Reference to Normal in
the template. (This is definitely the template, not the New Document). My
experience has been that a reference to normal results from abnormal closing
of word, or some other error, and causes problems in the template. I cannot
remove the Reference to Normal by unchecking the appropriate box.

Can anyone explain how to fix these templates so AutoNew runs?
How can I remove the reference to Normal?

Even if the result is that I have to create new templates, it would be
interesting to know what's behind the two issues I've described.

Thanks for any insights you might be able to offer about these issues,

Lesley --

PS: to Charles Kenyon who responded to an ASK fields question yesterday, I
am reading your draft chapter on Templates in addbalance and also have found
the "Using { Fields } in Microsoft Word" section that you are working on.
Thanks for your valuable links and explanations.

Still, if anybody can explain what I should do about these templates I'd
appreciate it.

Thanks very much,

Lesley
 
C

Charles Kenyon

Thank you for the kind words.

Those macros were written in Word 6 or before. You are trying to run them in
Word 10. The language and architecture changed radically between Word 6 and
Word 7. That some macros can be converted automatically and work is amazing.

If it were me, I would probably try to rewrite the forms and code. It would
take me less time, I suspect, than trying to convert and leave me with a
more robust template.

I have cross-posted this in the forum devoted to WordBasic because someone
there may be able to help.
--
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


--------- --------- --------- --------- --------- ---------
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.
 
L

Lesley Regan

Ah -- thank you for the advice. I thought that re-creating the templates
might be the most efficient thing to do.

I forgot there was a Word Basic group. I'll go look at it. I was using
keywords "Autonew", "Reference to Normal", "Template Troubleshooting" and
other such search terms.

Lesley
 
D

Doug Robbins - Word MVP

If the purpose of the macros was to prompt the user for information, you may
as well add a userform to the template

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
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
 
L

Lesley Regan

Thank you, Doug. I agree that a userform would be best, and thanks for the
advice and the link. I've gotten a lot of very useful tips on templates and
other matters from the MVP sites over the year or so I've been consulting
them. I'm impressed with the average time it takes to get a reply.

Regards from Lesley
 

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