View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ppt_puppet ppt_puppet is offline
external usenet poster
 
Posts: 1
Default Cell Format Function "NumberFormatLocal" in VBA

Hi,
I have a written a simple macro to convert local time to UTC. The conversion
has no problem but the CellNumberFormat to does not get change to "m/d/yyyy
h:mm". It remains "General". Here is the code of the function. Can someone
please help me in sorting out this issue. This macro would be used both in
Office 2003 and 2007.

Application.Volatile
ActiveCell.NumberFormatLocal = "m/d/yyyy h:mm"
od = dt
Set oShell = CreateObject("WScript.Shell")
atb =
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contr ol\TimeZoneInformation\ActiveTimeBias"
offsetMin = oShell.RegRead(atb)
nd = DateAdd("n", offsetMin, od)
LU = nd