Sub Click(Source As Button)
' --- Excelオブジェクト作成
Set excelObj = CreateObject("Excel.application")
' --- ExcelオブジェクトからWindowsバージョンを取得
Dim osVersion As Variant
osVersion = excelObj.Application.OperatingSystem
If osVersion = "Windows (32-bit) NT 5.01" Then
osName = "Windows XP"
Elseif osVersion = "Windows (32-bit) NT 5.00" Then
osName = "Windows 2000"
Elseif osVersion = "Windows (32-bit) 4.90" Then
osName = "Windows Me"
Elseif osVersion = "Windows (32-bit) 4.10" Then
osName = "Windows 98"
Elseif osVersion = "Windows (32-bit) 4.00" Then
osName = "Windows 95"
Elseif osVersion = "Macintosh (PowerPC) 10.13" Then
osName = "Mac OS X"
Elseif osVersion = "Macintosh (PowerPC) 9.00" Then
osName = "Mac OS 9"
Else
osName = "unknown"
End If
' --- 表示
msgTitle = "OS Information"
Msgbox "Version : " & osVersion & Chr(13) & "Name : " & osName, vbInformation, msgTitle
End Sub
|