Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running windows command from a VB code
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
command code ( GOTO command) in formula | New Users to Excel | |||
i have two windows xp running on my pc and seem to con flict with | Excel Discussion (Misc queries) | |||
How to Mute/Enable Windows Sounds whilst running VBA code | Excel Programming | |||
How to Mute/Enable Windows Sounds whilst running VBA code | Excel Programming | |||
Running command button click event code | Excel Programming |