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

  • Thread starter Thread starter gromit12
  • Start date Start date
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.
 
MsgBox Environ("OS")

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

Thanks!
Cliff Edwards
 
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)
 
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!
 
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
 
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?
 
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.
 
Back
Top