pc - to - mac vba template -- -syntax error on enum??

L

Lorin Lachs

Hi all,
Apologies if this is not the correct place to post this...

I have a Word template with a bunch of macros that I distribute to a
bunch of people every year or so. In the past, the recipients of this
template (let's call it "tools.dot") have all been running Office on
PCs. Now, I have a Mac user and I'd like to allow my template to work
for her too. Unfortunately, the template crashes Word (Word X) every
time it loads.

When I isolate the modules and view them in the visual basic editor
for Word X, it gives me a syntax error for the following statement

Public Enum blah
these
are
the
constants
end enum

Anyone have any tips? Also, are there any resources you can point me
to for pitfalls in porting a template from PC to Mac versions of vba
code?

Thanks!
Lorin
 
J

John McGhie

Hi Lorin:

Well, you have found the first pitfall of coding VBA in Word:Mac -- No
Enums. Sorry: Not supported (at all). Use an array, inside a
hash-define...

#If Mac then
... Populate your array
#Else
Declare your Enum
#End if

The constant "Mac" is maintained by the runtime and is a reliable way of
finding out if you are on a Mac.

A good rule of thumb is "If it doesn't work in Word 2000, it won't work on
the Mac."

Obviously if you are registering entry points in Windows .dlls you will get
sin-binned for that, too. There is a compiler constant named
"PathSeparator" that will return the correct file path separator for
handling file names cross-platform.

Most stuff you will do in userforms will render differently because Mac
pixels are a different size and shape. George has an article here:
http://word.mvps.org/Mac/MacWordVBA.html

Ensure that the user does not upgrade beyond Word 2004 on the Mac -- Word
2008 has no VBA interpreter at all. However, it would be useful for her to
update to 2004, it is generally faster, more stable, and less of a cut-down
than Word X.

Hope this helps

Hi all,
Apologies if this is not the correct place to post this...

I have a Word template with a bunch of macros that I distribute to a
bunch of people every year or so. In the past, the recipients of this
template (let's call it "tools.dot") have all been running Office on
PCs. Now, I have a Mac user and I'd like to allow my template to work
for her too. Unfortunately, the template crashes Word (Word X) every
time it loads.

When I isolate the modules and view them in the visual basic editor
for Word X, it gives me a syntax error for the following statement

Public Enum blah
these
are
the
constants
end enum

Anyone have any tips? Also, are there any resources you can point me
to for pitfalls in porting a template from PC to Mac versions of vba
code?

Thanks!
Lorin

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
L

Lorin Lachs

Hi Lorin:

Well, you have found the first pitfall of coding VBA in Word:Mac -- No
Enums.  Sorry:  Not supported (at all).  Use an array, inside a
hash-define...

#If Mac then
    ... Populate your array
#Else
    Declare your Enum
#End if

The constant "Mac" is maintained by the runtime and is a reliable way of
finding out if you are on a Mac.

A good rule of thumb is "If it doesn't work in Word 2000, it won't work on
the Mac."

Obviously if you are registering entry points in Windows .dlls you will get
sin-binned for that, too.  There is a compiler constant named
"PathSeparator" that will return the correct file path separator for
handling file names cross-platform.

Most stuff you will do in userforms will render differently because Mac
pixels are a different size and shape.  George has an article here:http://word.mvps.org/Mac/MacWordVBA.html

Ensure that the user does not upgrade beyond Word 2004 on the Mac -- Word
2008 has no VBA interpreter at all.  However, it would be useful for her to
update to 2004, it is generally faster, more stable, and less of a cut-down
than Word X.

Hope this helps








--
Don't wait for your answer, click here:http://www.word.mvps.org/

Please reply in the group.  Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia.   mailto:[email protected]

thanks so much for your help! looks like this is going to be trickier
than i thought. :-{
 

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