VBスクリプト
OS と Excel のバージョンを取得
VBSからExcelを介して取得する。
'OSのバージョンチェック
Dim ExcelApp
Dim excel_ver
Dim osName
Set ExcelApp = CreateObject("Excel.Application")
If Right(ExcelApp.OperatingSystem,4) = 4.00 Then
osName = "Windows95"
ElseIf Right(ExcelApp.OperatingSystem,4) = 4.10 Then
osName = "Windows98"
ElseIf Right(ExcelApp.OperatingSystem,4) = 4.90 Then
osName = "WindowsMe"
ElseIf Right(ExcelApp.OperatingSystem,4) = 5.00 Then
osName = "Windows2000"
ElseIf Right(ExcelApp.OperatingSystem,4) = 5.01 Then
osName = "WindowsXP"
ElseIf Right(ExcelApp.OperatingSystem,4) = 6.00 Then
osName = "WindowsVista"
ElseIf Right(ExcelApp.OperatingSystem,4) = 6.01 Then
osName = "Windows7"
ElseIf Right(ExcelApp.OperatingSystem,4) = 6.02 Then
osName = "Windows8"
ElseIf Right(ExcelApp.OperatingSystem,5) = 10.00 Then 'Windows (32-bit) NT 10.00
osName = "Windows10"
End If
MsgBox osName, vbInformation, "OSチェック"
'Officeのバージョンチェック
If ExcelApp.Version = 9.0 Then
excel_ver = "Office 2000"
ElseIf ExcelApp.Version = 10.0 Then
excel_ver = "Office 2002"
ElseIf ExcelApp.Version = 11.0 Then
excel_ver = "Office 2003"
ElseIf ExcelApp.Version = 12.0 Then
excel_ver = "Office 2007"
ElseIf ExcelApp.Version = 14.0 Then
excel_ver = "Office 2010"
ElseIf ExcelApp.Version = 15.0 Then
excel_ver = "Office 2013"
ElseIf ExcelApp.Version = 16.0 Then
excel_ver = "Office 2016"
End If
on error resume next
if IsNumeric(ExcelApp.Hinstance) = False then
MsgBox "Officeバージョン: " & ExcelApp.Version & " " & excel_ver & vbCrLf & "Office動作Bit数: " & " 64ビット", vbInformation, "Officeチェック"
else
MsgBox "Officeバージョン: " & ExcelApp.Version & " " & excel_ver & vbCrLf & "Office動作Bit数: " & " 32ビット", vbInformation, "Officeチェック"
end if
on error goto 0
Set ExcelApp = Nothing
戻る