Replacing Wordbasic.Call in Macros

P

Phil Stokes

I have various macros that were originally written in Wordbasic. I have
rewritten or converted most to VBA code but one particular piece of code
won't seem to work in VBA so I must be doing something wrong. an instance is

WordBasic.Call "somemacorname.ITUPrintPSToDisk", filename

will work but If I drop the Wordbasic it will not. (filename is a variable
containing a name of the file to be printed by the macro)

This may be very basic but I can't seem to get it to work.

ps I have got other Call commands to work but not when they refer to a
subroutine in a macro as the one above does.

Thanks

Phil
 
M

Martin Seelhofer

Hey Phil
WordBasic.Call "somemacorname.ITUPrintPSToDisk", filename

will work but If I drop the Wordbasic it will not. (filename is a variable
containing a name of the file to be printed by the macro)

Here are 2 possible solutions:

1. remove the "-s around your macroname and transform your code
into a normal VBA call:

Call somemacroname.ITUPrintPSToDisk(filename)

2. Use Application.Run instead:

Application.Run "somemacroname.ITUPrintPSToDisk", filename


Cheers,
Martin
 
P

Phil Stokes

Tried this
somemacorname.ITUPrintPSToDisk filename

but it didn't work.

I found that Application.Run worked ok and I'll use that code

Thanks to all that responded.

Phil
 
H

Howard Kaikow

Application.run is another alternative.
Depends on how things are set up.
 

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