Opening and working in other workbooks while VBA is running

sdoppke

Well-known Member
Joined
Jun 10, 2010
Messages
647
Hello - I am a workbook that counts down and scrapes a website every 30 minutes. However I am unable to open and work in other workbooks while this workbook countdown is running.

I use the DoEvents code, but this still does not let me work in other WBs at the same time.

Any tips or direction would really be appreciated.

Thanks!
SD
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi there. Have a look at using the Application.Ontime method. This schedules a macro to run in the future (i.e. your scraper code), but in the meantime will let you work on other workbooks.
 
Upvote 0
Hi there. Have a look at using the Application.Ontime method. This schedules a macro to run in the future (i.e. your scraper code), but in the meantime will let you work on other workbooks.


Thought I would share what worked for me. Thanks again John. BTW, I'm a dirty coder, so be aware my code is not the most efficient. :)

VBA Code:
Option Explicit
Public ScheduledTime As Double
Public Const Interval = 5 '5 seconds
Public Const MyProc = "ScrapeThis"

Sub Timer()

ScheduledTime = Now + Workbooks("RTM_Tool").Sheets("RTM").Range("K9").Value
Application.OnTime ScheduledTime, MyProc

End Sub

Sub stopTimer()

On Error Resume Next
Application.OnTime ScheduledTime, "ScrapeThis", , False
MsgBox "Timer Stopped, needs to be re-started to work again..."

End Sub
 
Upvote 0
Thanks for the feedback and well done on deriving a solution from my small guidance. We're nearlyall dirty coders!
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,250
Members
449,305
Latest member
Dalyb2

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