WordBasic call CountMacros always returns 3

U

Uday

I am working on application that uses "WordBasic" method calls.
One of the call it uses is "CountMacros".

I invoke the application with a word document that has macros "Macro1" and
"Macro2" as part of normal.dot template to perform some functionality.

Now the "CountMacros" call should return 5. But it doesnot do so.
I checked the macro names, it lists "ThisDocument", "NewMacros" and
"Module1" as the only macros available.

I am able to view as well as use the macros "Macro1" and "Macro2" in the
word document manually but not programatically.

I cannot change the "WordBasic" calls.

Can anyone help me out with reasons for such behavior? OR
Am I doing something wrong? OR
Do I need to do anything else to get the macros in my program?

Thanks in advance.
 
J

Jonathan West

Hi Uday,

The behaviour od this changed when Word went from WordBasic to VBA in Word
97. WordBasic.CountMacros now counts modules, not macros.

I'm not aware of any reliable way of counting macros.
 
U

Uday

Hi Jonathan,

Thank you for the information.

Where can I get such information regarding "WordBasic" calls and its
present functionality? Because my clients application code uses a lot of
"WordBasic" calls and the breaks when tested with Office > 97.
OR
Where can I find information regarding equivalent calls in VBA.?

Regards,
Uday.
 
H

Helmut Weber

Hi Uday,

there is plenty of information in the VBA-Help.
Just search help for "Visual Basic".

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
U

Uday

Hi,

Thank you for the answers.

I shall try out at the conversion process and get back if anthing in need.

Regards,
Uday.
 
J

Jonathan West

Hi Uday

Uday said:
Hi Jonathan,

Thank you for the information.

Where can I get such information regarding "WordBasic" calls and its
present functionality? Because my clients application code uses a lot of
"WordBasic" calls and the breaks when tested with Office > 97.

Take a look here


Most of the WordBasic methods are simply the old WordBasic commands
 
J

Jonathan West

Uday said:
Hi Jonathan,

Thank you for the information.

Where can I get such information regarding "WordBasic" calls and its
present functionality? Because my clients application code uses a lot of
"WordBasic" calls and the breaks when tested with Office > 97.
OR
Where can I find information regarding equivalent calls in VBA.?

These articles will help

Making the transition from WordBasic to VBA
http://word.mvps.org/FAQs/MacrosVBA/WordBasicToVBA.htm

Useful WordBasic commands that have no VBA equivalent
http://word.mvps.org/FAQs/MacrosVBA/WordBasicCommands.htm

The methods of the WordBasic object are mainly the WordBasic command from
Word 95. The second of the articles contains a link to a location on the
Microsoft website where you can download the Word 95 Wordbasic Help file.
 

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