Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default How to check Operating System?

Hello I've been using WinAPI calls to do some swanky stuff, but although no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to check Operating System?

Maybe

opsystem = Environ(13)

Mike

"NateBuckley" wrote:

Hello I've been using WinAPI calls to do some swanky stuff, but although no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default How to check Operating System?

Thank you sir! Went through the numbers and was 12 that told me the OS.
Taking it this wouldn't work on a Mac? So Guess just do a test to see if that
call fails, if so goto label then change a bool or something.

Thanks matey!

"Mike H" wrote:

Maybe

opsystem = Environ(13)

Mike

"NateBuckley" wrote:

Hello I've been using WinAPI calls to do some swanky stuff, but although no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to check Operating System?

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but although
no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default How to check Operating System?

Thank you very much, just what I wanted.

Your a star.

If you have the time may I ask what # means? I shall go and attempt to find
out what they mean from google.

Thanks again

"Peter T" wrote:

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but although
no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to check Operating System?

Search "compile" and/or "conditional compilation" in VBA help

Regards,
Peter T


"NateBuckley" wrote in message
...
Thank you very much, just what I wanted.

Your a star.

If you have the time may I ask what # means? I shall go and attempt to
find
out what they mean from google.

Thanks again

"Peter T" wrote:

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but
although
no
one uses Macs where I work, I'd like (if possible) to aquire the
operating
system information so IF Mac then don't do WinAPI calls etc. Not really
an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default How to check Operating System?

you can try this:
environ("OS")

or, somebody wrote this, can't remember who, though:

Sub ListEnvioron()
Dim Rng As Range
Dim Ndx As Long
Dim S As String
Dim Pos As Long

Ndx = 1
On Error Resume Next
Set Rng = Range("A1")
Do While True
S = Environ(Ndx)
If Err.Number < 0 Then
Exit Do
End If
Pos = InStr(1, S, "=")
Rng.Value = Left(S, Pos - 1)
Rng(1, 2).Value = Mid(S, Pos + 1)
Ndx = Ndx + 1
Set Rng = Rng(2, 1)
Loop
End Sub

--


Gary


"Peter T" <peter_t@discussions wrote in message
...
Search "compile" and/or "conditional compilation" in VBA help

Regards,
Peter T


"NateBuckley" wrote in message
...
Thank you very much, just what I wanted.

Your a star.

If you have the time may I ask what # means? I shall go and attempt to find
out what they mean from google.

Thanks again

"Peter T" wrote:

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but although
no
one uses Macs where I work, I'd like (if possible) to aquire the operating
system information so IF Mac then don't do WinAPI calls etc. Not really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default How to check Operating System?

And don't forget: Application.OperatingSystem

--
Jim
"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
| you can try this:
| environ("OS")
|
| or, somebody wrote this, can't remember who, though:
|
| Sub ListEnvioron()
| Dim Rng As Range
| Dim Ndx As Long
| Dim S As String
| Dim Pos As Long
|
| Ndx = 1
| On Error Resume Next
| Set Rng = Range("A1")
| Do While True
| S = Environ(Ndx)
| If Err.Number < 0 Then
| Exit Do
| End If
| Pos = InStr(1, S, "=")
| Rng.Value = Left(S, Pos - 1)
| Rng(1, 2).Value = Mid(S, Pos + 1)
| Ndx = Ndx + 1
| Set Rng = Rng(2, 1)
| Loop
| End Sub
|
| --
|
|
| Gary
|
|
| "Peter T" <peter_t@discussions wrote in message
| ...
| Search "compile" and/or "conditional compilation" in VBA help
|
| Regards,
| Peter T
|
|
| "NateBuckley" wrote in message
| ...
| Thank you very much, just what I wanted.
|
| Your a star.
|
| If you have the time may I ask what # means? I shall go and attempt to
find
| out what they mean from google.
|
| Thanks again
|
| "Peter T" wrote:
|
| #If Mac Then
| ' it's a Mac
| #Else
| ' it's not a Mac
| #End If
|
| Regards,
| Peter T
|
| "NateBuckley" wrote in message
| ...
| Hello I've been using WinAPI calls to do some swanky stuff, but
although
| no
| one uses Macs where I work, I'd like (if possible) to aquire the
operating
| system information so IF Mac then don't do WinAPI calls etc. Not
really an
| issue at the moment but always good to know just in case.
|
| Is this possible with VBA?
|
| Cheers!
|
|
|
|
|
|
|


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default How to check Operating System?

yep, that's another one, thanks, jim.

--


Gary


"Jim Rech" wrote in message
...
And don't forget: Application.OperatingSystem

--
Jim
"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
| you can try this:
| environ("OS")
|
| or, somebody wrote this, can't remember who, though:
|
| Sub ListEnvioron()
| Dim Rng As Range
| Dim Ndx As Long
| Dim S As String
| Dim Pos As Long
|
| Ndx = 1
| On Error Resume Next
| Set Rng = Range("A1")
| Do While True
| S = Environ(Ndx)
| If Err.Number < 0 Then
| Exit Do
| End If
| Pos = InStr(1, S, "=")
| Rng.Value = Left(S, Pos - 1)
| Rng(1, 2).Value = Mid(S, Pos + 1)
| Ndx = Ndx + 1
| Set Rng = Rng(2, 1)
| Loop
| End Sub
|
| --
|
|
| Gary
|
|
| "Peter T" <peter_t@discussions wrote in message
| ...
| Search "compile" and/or "conditional compilation" in VBA help
|
| Regards,
| Peter T
|
|
| "NateBuckley" wrote in message
| ...
| Thank you very much, just what I wanted.
|
| Your a star.
|
| If you have the time may I ask what # means? I shall go and attempt to
find
| out what they mean from google.
|
| Thanks again
|
| "Peter T" wrote:
|
| #If Mac Then
| ' it's a Mac
| #Else
| ' it's not a Mac
| #End If
|
| Regards,
| Peter T
|
| "NateBuckley" wrote in message
| ...
| Hello I've been using WinAPI calls to do some swanky stuff, but
although
| no
| one uses Macs where I work, I'd like (if possible) to aquire the
operating
| system information so IF Mac then don't do WinAPI calls etc. Not
really an
| issue at the moment but always good to know just in case.
|
| Is this possible with VBA?
|
| Cheers!
|
|
|
|
|
|
|




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to check Operating System?

Gary, unfortunately, depending on the system (incl some Windows), you cannot
rely on environ("OS") to return anything at all.

Mike H, opsystem = Environ(13)
that "OS" relates to 13 is purely specific to your own machine

Regards,
Peter T

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
you can try this:
environ("OS")

or, somebody wrote this, can't remember who, though:

Sub ListEnvioron()
Dim Rng As Range
Dim Ndx As Long
Dim S As String
Dim Pos As Long

Ndx = 1
On Error Resume Next
Set Rng = Range("A1")
Do While True
S = Environ(Ndx)
If Err.Number < 0 Then
Exit Do
End If
Pos = InStr(1, S, "=")
Rng.Value = Left(S, Pos - 1)
Rng(1, 2).Value = Mid(S, Pos + 1)
Ndx = Ndx + 1
Set Rng = Rng(2, 1)
Loop
End Sub

--


Gary


"Peter T" <peter_t@discussions wrote in message
...
Search "compile" and/or "conditional compilation" in VBA help

Regards,
Peter T


"NateBuckley" wrote in message
...
Thank you very much, just what I wanted.

Your a star.

If you have the time may I ask what # means? I shall go and attempt to
find
out what they mean from google.

Thanks again

"Peter T" wrote:

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but
although
no
one uses Macs where I work, I'd like (if possible) to aquire the
operating
system information so IF Mac then don't do WinAPI calls etc. Not
really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!











  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default How to check Operating System?

guess i have to believe you, but it seems to work for me here on a 98 pc, 1
xp home pc, 3 xp pro pc's, win2k3 x64 server r2, vista business x64, vista
ultimate x32 and win2k8 x32 server.

--

Gary
Excel 2003


"Peter T" <peter_t@discussions wrote in message
...
Gary, unfortunately, depending on the system (incl some Windows), you
cannot rely on environ("OS") to return anything at all.

Mike H, opsystem = Environ(13)
that "OS" relates to 13 is purely specific to your own machine

Regards,
Peter T

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
you can try this:
environ("OS")

or, somebody wrote this, can't remember who, though:

Sub ListEnvioron()
Dim Rng As Range
Dim Ndx As Long
Dim S As String
Dim Pos As Long

Ndx = 1
On Error Resume Next
Set Rng = Range("A1")
Do While True
S = Environ(Ndx)
If Err.Number < 0 Then
Exit Do
End If
Pos = InStr(1, S, "=")
Rng.Value = Left(S, Pos - 1)
Rng(1, 2).Value = Mid(S, Pos + 1)
Ndx = Ndx + 1
Set Rng = Rng(2, 1)
Loop
End Sub

--


Gary


"Peter T" <peter_t@discussions wrote in message
...
Search "compile" and/or "conditional compilation" in VBA help

Regards,
Peter T


"NateBuckley" wrote in message
...
Thank you very much, just what I wanted.

Your a star.

If you have the time may I ask what # means? I shall go and attempt to
find
out what they mean from google.

Thanks again

"Peter T" wrote:

#If Mac Then
' it's a Mac
#Else
' it's not a Mac
#End If

Regards,
Peter T

"NateBuckley" wrote in message
...
Hello I've been using WinAPI calls to do some swanky stuff, but
although
no
one uses Macs where I work, I'd like (if possible) to aquire the
operating
system information so IF Mac then don't do WinAPI calls etc. Not
really an
issue at the moment but always good to know just in case.

Is this possible with VBA?

Cheers!










  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to check Operating System?

:-)

It works on my XP & Vista, but on W98se neither "OS" nor even "Username"
work with Environ.

There are plenty of reports about the unreliable nature of Environ.

Regards,
Peter T


"Gary Keramidas" wrote in message
...
guess i have to believe you, but it seems to work for me here on a 98 pc,
1 xp home pc, 3 xp pro pc's, win2k3 x64 server r2, vista business x64,
vista ultimate x32 and win2k8 x32 server.

--

Gary
Excel 2003


"Peter T" <peter_t@discussions wrote in message
...
Gary, unfortunately, depending on the system (incl some Windows), you
cannot rely on environ("OS") to return anything at all.

Mike H, opsystem = Environ(13)
that "OS" relates to 13 is purely specific to your own machine

Regards,
Peter T

<snip


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
Determining whether XP or Vista is the operating system Bob Flanagan Excel Programming 3 April 2nd 07 04:14 PM
running a macro on a different operating system Jez[_6_] Excel Programming 3 August 25th 05 08:03 PM
Find out Operating System Mohan[_2_] Excel Programming 5 January 16th 04 08:36 PM
Operating system Don Guillett[_4_] Excel Programming 0 September 10th 03 04:43 PM
Operating system Stephan Kassanke Excel Programming 0 September 10th 03 04:42 PM


All times are GMT +1. The time now is 11:10 PM.

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

About Us

"It's about Microsoft Excel"