MrExcel Message Board
Support This Site


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Mar 30th, 2004, 07:46 PM   #1
McLaren
 
Join Date: Jul 2003
Location: California
Posts: 111
Default Not sure how to implement OS Version Info.

I am trying to dictate a file path based on OS Version, but am not sure how to do it exactly. I found this code for determining the OS, and I believe it goes in a module, but how do I access the results for my CommandButton?
Any help is appreciated.

Function OS_Version() As String
Dim Os As OSVERSIONINFO
Dim m As Long
Dim MjV As Long
Dim PId As Long
Dim MnV As Long

Os.dwOSVersionInfoSize = Len(Os)
m = GetVersionEx(Os)
MjV = Os.dwMajorVersion
PId = Os.dwPlatformId
MnV = Os.dwMinorVersion

If PId = 2 Then
'// NT,2000,XP
Select Case Os.dwMajorVersion
Case Is = 3
OS_Version = " Windows NT 3." & Os.dwMinorVersion
Case Is = 4
OS_Version = " Windows NT 4 "
Case Is = 5
Select Case Os.dwMinorVersion
'// win 2000
Case Is = 0
OS_Version = " Windows Windows 2000 "
'// win XP or win .NET server
Case Is = 1
OS_Version = " Windows XP "
Case Else
OS_Version = " Windows .NET Server "
End Select
End Select
End If

If PId = 1 Then
If MnV = 10 Then OS_Version = " Windows 98 "
If MnV = 0 Then OS_Version = " Windows 95 "
If MnV = 90 Then OS_Version = " Windows ME "
End If

End Function
McLaren is offline   Reply With Quote
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 03:19 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.