VBA to test at runtime: Windows PC vs. Mac

D

downwitch

Hi,

I've seen the articles at mvps.org/word alluding to testing at runtime
whether a macro is running on a PC or Mac, but don't know how to test
for this, and can't find the answer in the newsgroup archives either.
I'm sure it's simple code, but it's very hard to search for...

Thanks in advance.
 
K

Karl E. Peterson

I've seen the articles at mvps.org/word alluding to testing at runtime
whether a macro is running on a PC or Mac, but don't know how to test
for this, and can't find the answer in the newsgroup archives either.
I'm sure it's simple code, but it's very hard to search for...

Here's one WAG: Error-trap a call to some innocuous Win32 API.
 
H

Helmut Weber

....
or check the macintosh name, like:

On Error Resume Next
MsgBox System.MacintoshName
If Err.Number = 5948 Then
MsgBox "no mac, thx"
End If
On Error GoTo 0

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

Jonathan West

Hi,

I've seen the articles at mvps.org/word alluding to testing at runtime
whether a macro is running on a PC or Mac, but don't know how to test
for this, and can't find the answer in the newsgroup archives either.
I'm sure it's simple code, but it's very hard to search for...

Thanks in advance.

The simplest way is to get the value of the System.OperatingSystem property.
If you are running on a PC, it will have "Windows" in the name. If you are
running a Mac, it won't.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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