"Amedee Van Gasse" wrote in message
...
Sure!
If I knew that in the first place, I would have given you the
following answer.
In the Microsoft Script Center, I found the following script:
----- CUT HERE -----
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_LocalTime") For Each objItem in colItems
Wscript.Echo "Day: " & objItem.Day
Wscript.Echo "Day Of the Week: " & objItem.DayOfWeek
Wscript.Echo "Hour: " & objItem.Hour
Wscript.Echo "Milliseconds: " & objItem.Milliseconds
Wscript.Echo "Minute: " & objItem.Minute
Wscript.Echo "Month: " & objItem.Month
Wscript.Echo "Quarter: " & objItem.Quarter
Wscript.Echo "Second: " & objItem.Second
Wscript.Echo "Week In the Month: " & objItem.WeekInMonth
Wscript.Echo "Year: " & objItem.Year
Next
----- CUT HERE -----
This is in VBScript and is for Windows XP/2003. 2000, NT4 and 98
don't support the Win32_LocalTime class used in this script (AFAIK).
You should be able to rewrite this script to VBA, perhaps changing
every Wscript.Echo to Debug.Print or even MsgBox will do the job
(IDNTT).
The trick here is to change strComputer. Here it is "." which means
the local computer. Change this to the name of your time server in
your local network, et voila!
I assume stuff like permissions are also involved, but if you need
more help to get it working, you should really check out
news:microsoft.public.windows.server.scripting
Good luck!
Hi,
Well - I learnt a lot about server scripts which was very interesting!
I actually ended up solving it in a simpler way by using the command
line parameters of the 'net time' command - see below.
The following executes the command but also sets the client system
clock from the server clock at the same time, so I get where I want to
go in a single step.
Sub TimeCheck()
Shell ("net time \\server /set /yes")
End Sub
Thanks for your help - I really appreciate it.
Alan.