So, I'm doing this watch program. I have a loop that I use to continuously update time. But for some reason, the system doesn't recognise the Do
at start of loop. It is in a while loop, if that changes anything. I also put a On Error Resume Next
but still get error message. Is this linked? Help would be greatly appreciated. Here's source code:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
While ie.ReadyState <> 4 : WScript.Sleep 100 : Wend
ie.ToolBar = False
ie.StatusBar = False
ie.Width = 200
ie.Height = 250
ie.document.body.innerHTML = "<p id='msg'>0</p>"
Set style = ie.document.CreateStyleSheet
style.AddRule "p", "text-align: center;"
ie.Visible = True
Do
Set colItems = objWMIService.ExecQuery("Select * from Win32_LocalTime")
If objItem.DayOfWeek = 1 Then
day_name = "Monday"
Else If objItem.DayOfWeek = 2 Then
day_name = "Tuesday"
Else If objItem.DayOfWeek = 3 Then
day_name = "Wednesday"
Else If objItem.DayOfWeek = 4 Then
day_name = "Thursday"
Else If objItem.DayOfWeek = 5 Then
day_name = "Friday"
Else If objItem.DayOfWeek = 6 Then
day_name = "Saturday"
Else
day_name = "Sunday"
End If
For Each objItem In colItems
ie.document.getElementById("msg").innerText = "Date:" & vbCrLf & day_name & vbCrLf & objItem.Day & "/" & objItem.Month & "/" & objItem.Year & vbCrLf & vbCrLf & "Time:" & vbCrLf & objItem.Hour & " : " & objItem.Minute & " : " & objItem.Second
Next
Loop
While End