get current timezone in excel code example
Example: 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