ExcelVBAで動いているWindowsが32bitか64bitか判断する

Function GetProcessBit() As String

    Dim colItems As Object
    Dim itm As Object
    
    Set colItems = CreateObject("WbemScripting.SWbemLocator").ConnectServer.ExecQuery("Select * From Win32_OperatingSystem")
    
    GetOSProcessBit = "32"
    For Each itm In colItems
        If InStr(itm.OSArchitecture, "64") Then
            GetOSProcessBit = "64"
        Else
           GetOSProcessBit = "32"
        End If
        
        Exit For
    Next
   
    Set colItems = Nothing
End Function


ネタ元