Skip to main content

Detect OS Type

Used to detect if OS Type is Windows or macOS

Sub GetOSType()
    'Get the OS that I am running from
    Dim OSType      As String
    OSType = Application.OperatingSystem
    If OSType Like "*Windows*" Then
        OSType = "Windows"
    Else
        If OSType Like "*Macintosh*" Then
            OSType = "macOS"
        End If
    End If
    'Message box of the detected OS
    MsgBox OSType
End Sub