Need Help - Macro from Windows Word won't run on Mac

K

ksb

First off let me say I am fairly computer literate but have no
experience with macros and I am by no means a Word guru.

I received a Word file from someone (it's actually a .dot), that
contains a macro. The macro is supposed to run a calculation, seems
like it should be fairly simple, essentially its a statistical
formula, you enter 3 variables to get an answer. It apparently runs
without issue on a PC, when I try to run it I get a "Compile Error:
Sub or Function not defined." I click OK it brings up the VBE with a
word highlighted but I don't know what to do with it from there.

Any help would be greatly appreciated. I can give you more details,
post the file whatever, just wasn't sure where to go next.

If it matters I am running Word X (although I have a newer version)
running on a 2x2 Intel Mac running 10.5.8.
 
C

CyberTaz

I'm by no means the "VBA Guy" but I can say that there are different
versions of VBA [Windows is always 1 version ahead of Mac] and that there
are language differences on the 2 platforms. My guess is that you are
running into one or both of those issues. The code can usually be modified
to run effectively.

Copy the code from the VBA editor & paste it into a reply here. I'm pretty
sure one of the regulars who's more familiar with code will be able to to
spot the problem & help you get it adjusted.

You don't specify what "newer version" of Mac Office you have, but if it's
2004 you might see if you get the same result there -- it may simply be that
the VBA version supported by v.X is the problem. If your newer version is
2008, however, don't bother... Office 2008 offers no VBA support at all.
 
J

John McGhie

Without seeing the code, it is difficult to advise. Basically, the
highlighted "word" does not exist.

That may be because it does not exist in Mac Word VBA, or because it is a
VBA function the author has forgotten to include.

If it is the former, you can surround the offending command with a "Hash
Define" compiler directive so it does not attempt to compile on the Mac:

#IF Mac then
... Work-around code goes here
#Else
... Original code goes here
#EndIF

The hash symbols are required. The constant "Mac" is maintained by VBA and
returns TRUE if you are on a Mac.

For this kind of thing, I would strongly recommend that you do this in
Excel. You can include a little snippet of Excel in your Word document if
you wish.

But Word and VBA is not a good place to be attempting Statistical
calculations :)

Hope this helps

First off let me say I am fairly computer literate but have no
experience with macros and I am by no means a Word guru.

I received a Word file from someone (it's actually a .dot), that
contains a macro. The macro is supposed to run a calculation, seems
like it should be fairly simple, essentially its a statistical
formula, you enter 3 variables to get an answer. It apparently runs
without issue on a PC, when I try to run it I get a "Compile Error:
Sub or Function not defined." I click OK it brings up the VBE with a
word highlighted but I don't know what to do with it from there.

Any help would be greatly appreciated. I can give you more details,
post the file whatever, just wasn't sure where to go next.

If it matters I am running Word X (although I have a newer version)
running on a 2x2 Intel Mac running 10.5.8.

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 

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