Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How can I know whether an excel sheet is running in a PC or Mac environment?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default How can I know whether an excel sheet is running in a PC or Mac environment?

MsgBox Environ("OS")

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

Thanks!
Cliff Edwards
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How can I know whether an excel sheet is running in a PC or Mac environment?

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)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How can I know whether an excel sheet is running in a PC or Mac environment?

On Feb 7, 6:09*pm, "Rick Rothstein"
wrote:
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!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default How can I know whether an excel sheet is running in a PC or Mac environment?

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default How can I know whether an excel sheet is running in a PC or Mac environment?

On Tue, 8 Feb 2011 16:24:02 -0800 (PST), ward376
wrote:

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.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default How can I know whether an excel sheet is running in a PC or Mac environment?

On Mon, 7 Feb 2011 17:09:01 -0800 (PST), ward376
wrote:

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?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Run-time Environment rick Excel Programming 2 July 17th 09 07:16 AM
Running an excel sheet which uses RTD calls as a service? Benjamin Peikes Excel Programming 0 August 8th 08 08:12 PM
running macros/vba code in a shared environment Eric[_27_] Excel Programming 1 January 25th 05 11:27 AM
Copy Excel sheet into IE environment Ivan Lam Excel Programming 0 June 16th 04 02:47 AM
Running Code on Each Sheet in an Excel Workbook bearie Excel Programming 2 February 6th 04 03:54 PM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"