• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to derive system time zone

ThrottleWorks

Excel Ninja
Hi,

I need to process data based on the time zone of the user’s system.

Sometimes, user’s system might be configured to GMT, sometimes system might be running for IST.

How to derive system time zone through VBA.
Can anyone please help me in this.
 
Hi @shrivallabha , I am trying below code. Found at Chandoo only !

Good night. :)

http://forum.chandoo.org/threads/how-to-display-the-system-timezone-in-a-excel-cell.29641/

Code:
Sub GetMyTimeZone()
    Dim strPath As String
    strPath = GetTimeZone
    MapSht.Range("D2").Value = strPath
End Sub
Function GetTimeZone() As String
    Dim oItem, colItems
    Application.Volatile True
    Set colItems = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * From Win32_TimeZone")
   
    For Each oItem In colItems
        GetTimeZone = oItem.Caption
    Next
End Function
 
Back
Top