How can I know whether an excel sheet is running in a PC or Mac environment?

G

gromit12

Hi,

I have some code that runs fine on a PC but trips up a mac. I have
found a workaround for the mac, but I need to find a way to shield the
code in eaqch case, along the lines of:

If [I'm running on a Mac] then
mac code
Else
PC code
End if

Anyone know how to do this? Thanks in advance.
 
W

ward376

MsgBox Environ("OS")

Returns 'Windows_NT' on my XP machine, never tried it on a Mac.

Thanks!
Cliff Edwards
 
R

Rick Rothstein

MsgBox Environ("OS")

Returns 'Windows_NT' on my XP machine, never tried it on a Mac.

That would be a problem on a Mac using Excel 2008... there is no VBA in that
version. This worksheet function can be used to determine the operating
system...

=INFO("system")

It will return either "mac" or "pcdos" as appropriate.

Rick Rothstein (MVP - Excel)
 
G

gromit12

MsgBox Environ("OS")

Returns 'Windows_NT' on my XP machine, never tried it on a Mac.

That would be a problem on a Mac using Excel 2008... there is no VBA in that
version. This worksheet function can be used to determine the operating
system...

=INFO("system")

It will return either "mac" or "pcdos" as appropriate.

Rick Rothstein (MVP - Excel)

Thank you!
 
W

ward376

Yes, Environ("OS") would be useless if VBA weren't available, but the
OP
stated that he had working code for Mac, just needed a way to
determine
what environment the code was running in to see whether to run pc
code
or Mac code.

Just sayin'. ;)

Respectfully,
Cliff Edwards
 
C

CellShocked

MsgBox Environ("OS")

Returns 'Windows_NT' on my XP machine, never tried it on a Mac.

Thanks!
Cliff Edwards


What would return in a remote session? The OS of the client or the OS of
the host?
 
C

CellShocked

Yes, Environ("OS") would be useless if VBA weren't available, but the
OP
stated that he had working code for Mac, just needed a way to
determine
what environment the code was running in to see whether to run pc
code
or Mac code.

Just sayin'. ;)

Respectfully,
Cliff Edwards

The fact that there is a requisite of a differential is a problem and
breaks programming rules from decades ago.

You guys could not make a MAC port that was fully compliant?

No, not merely opening of files, but FULLY compliant. No re-do
required.

Pretty sad the CRAP that Apple has put the world through. Thir crap
artificially inflated prices throughout the industry. Jobs is an idiot.
His money grubbing will be/IS part of what harms this nation's economy.

None of you phone wielding twits will ever see it though, since you are
all hard wired with horse blinders on.
 

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