|
-
May 5th, 2013, 06:20 PM
#1
Thread Starter
Addicted Member
VBA 2010: Help with checking a website for changes at a set frequency
Hello,
I'd like to automatically check a website once or twice a day to see if it has been updated with new information. Right now, I am polling the clock as a means to determine elapsed time. I'm told that this results in unnecessary use of the CPU and that I should look into a timer event. I'm unable to determine how to do this in Excel.
Here is the code that I'm using:
Code:
Public Sub MyTimer(timeinhours)
Dim N As Date
N = Now
Do While DateDiff("s", CDate(N), CDate(Now)) < timeinhours * 3600: DoEvents: Loop ' Note: return time from Datediff is in seconds.
End Sub
-
May 6th, 2013, 06:38 AM
#2
Re: VBA 2010: Help with checking a website for changes at a set frequency
look into application.ontime
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|