Using Now Time- to avoid file read/write to file at same time

dantheman9

Board Regular
Joined
Feb 5, 2011
Messages
175
Im sure this should be easy to work out, but just after some advice on it!
I have a sub which runs every 10 mins using Now Time +10 mins, this sub wirtes a new html file.

The html file has a meta refresh tag - to refreah every 20 mins.
Trouble is, I need to avoid any conflict from the two (the sub rewirting the file, at the same time as the page refresh).

What would be the best way to stop this (would it be best to set the sub update from a time stamp from the html creation?).

any ideas would be much help!!!

thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You could add the following to you Sub so that it doesnt execute on the 20 minute interval

Code:
If Minute(Now()) = "20" Or Minute(Now()) = "40" Or Minute(Now()) = "0" Then
'Have then have the Sub Quit and re-run in a minutes time
Else
'Run Your Code
End If

Now that I posted that I see that your code may not necessarily be executed on the hour and then 20 mins after that
 
Upvote 0
thanks comfy,

yeah the second update won't be picked up by the html refresh - as it will still have 10 mins to go....for the time going I have alter the Sub command to run at old numbers, while keeping the html at evens - hopefully that could be ok for 8 or so hours (taking into acount 10 or so seconds for the sub to run.)

Cheers

Dan
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top