Answers for "excel get time zone"

0

excel get time zone

Function GetTimeZoneAtPresent() As String
'Updated by Extendoffice 20180814
    Dim xObjIs, xObjI
On Error GoTo ER
    Set xObjIs = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * From Win32_TimeZone")
    If xObjIs.Count = 1 Then
        For Each xObjI In xObjIs
            If Len(xObjI.Caption) > 1 Then
                GetTimeZoneAtPresent = xObjI.Caption
                Exit Function
            Else
                GetTimeZoneAtPresent = "Null"
                Exit Function
            End If
        Next
    End If
ER:
    GetTimeZoneAtPresent = "Failed"
End Function
Posted by: Guest on February-17-2021

Browse Popular Code Answers by Language