Function/trick (_not_ VBA) for determining Mac vs. Windows?

D

Dave

Hello,

Is there a function that I can use in cells to determine whether a
workbook is being viewed in Mac or Windows? I know that there is a VBA
function Environ(...), but this workbook is so far free of that
particular infection, and I need to keep it that way, to avoid that
annoying (and, to some clients, scary) warning dialog that comes up
when opening a workbook with macros.

I'd even be happy with a function that produces a reliable error on one
platform and not the other that I could use in an IF function.

Thanks
 
K

Ken Johnson

Hi Dave,
This formula works because PCs use \ in filename and Macs don't.

=IF(ISERROR(FIND("\",CELL("filename"))),"Mac","PC")

Ken Johnson
 
K

Ken Johnson

Hi Dave,
Found a simpler way!

=INFO("system")

Returns pcdos or mac

Advantage: will work even on unsaved files.

Ken Johnson
 
J

Jack Marr

How would one use this in VB? I've tried this, but get a #VALUE!
error.

Public Function getsystem()
Dim sys As String
sys = Application.INFO("system")
getsystem = sys
End Function
 
B

Bob Greenblatt

How would one use this in VB? I've tried this, but get a #VALUE!
error.

Public Function getsystem()
Dim sys As String
sys = Application.INFO("system")
getsystem = sys
End Function

The INFO function is an old-time carry over to allow compatibility with
Lotus. As such, I'm not too surprised that it is not accessible through the
application object.

You could try:
Public Function getsystem()
getsystem = Left(Application.OperatingSystem, 3)
End Function


It looks like the INFO command causes VBA to terminate, so not even this:

executeexcel4macro("info(""system"")")

Works.
 

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