Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro help in capturing server time

Hi

Need help with this VB code.

What the current code does is - Picks up time from US Navy websit
http://tycho.usno.navy.mil

I would like to modify it to capture the server time (The time I get b
running the command "net time" at the command prompt in Windows).

For reference the IP address of the server can be taken to b
192.168.1.17

Thanks,
Saurabh


Sub TimeAfterTime()

With Application
.ScreenUpdating = False
.DisplayAlerts = False
.Calculation = xlCalculationManual
End With

Dim WebCopy As Object
Dim WebURL As String
Set WebCopy = Sheets("Sheet2")
WebURL = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
WebCopy.Activate
Cells.Clear

With WebCopy.QueryTables.Add(Connection:="URL;" & WebURL
Destination:=WebCopy.Range("A1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

Range("1:2").EntireRow.Delete
Range(("A2"), Range("A2").End(xlDown)).EntireRow.Delete
With Range("A1")
.Replace What:="
", Replacement:=""
.Replace What:="UTC", Replacement:=""
.Replace What:=".", Replacement:=""
.Replace What:=", ", Replacement:=", " & Year(Now) & " "
.Value = Trim(.Value)
.NumberFormat = "mmmm d, yyyy, hh:mm:ss"
End With

Range("B1").FormulaR1C1 = "=R1C1-TIME(5,,)"
Range("B1").Value = Range("B1").Value
Columns(2).AutoFit
Columns(1).Delete Shift:=xlToLeft

With Application
.ScreenUpdating = True
.DisplayAlerts = True
.Calculation = xlCalculationAutomatic
End With

End Su

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Real Time Data Rob Excel Worksheet Functions 2 February 24th 10 04:44 AM
VB Code Required for Capturing Time TGV Excel Discussion (Misc queries) 4 February 14th 09 03:26 PM
Date Capturing by Time Ken Excel Discussion (Misc queries) 1 December 2nd 07 10:50 AM
Help : Macro for capturing current system time imr Excel Programming 3 July 2nd 04 02:58 AM
capturing a cell value at a specific time of day Thomas Donino Excel Programming 1 January 13th 04 01:45 PM


All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"