• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Detect when Data Connections have finished

David Jenkins

New Member
Hi there,

I have a 2010 Workbook that gets opened by Windows Task Scheduler.

It has the Refresh Data Sources checked for when the workbook is opened.

I wondered in VBA how I could detect when the Data Connections have finished and then save and close the workbook.

I previously had a different that used Worksheet_Change to save and close it but that are multiple sheets that will be updating!

Regards,

Dave.
 
Its checked at the moment but I could un-check it.

Basically, just need the VBA to say:

"Okay, all the data has finished downloading - I now need to save myself and close myself"

Regards,

Dave.
 
Okay, I disabled the Enable Background Refresh stumbled across another forum and found something called

Sub Workbook_Open()

I then added in ActiveWorkbook.RefreshAll

I then added ActiveWorkbook.Save and ActiveWorkbook.Close

It works great

However, this leads to another question ..... because it does all that I cant get back into the workbook, is there a way of opening the workbook without it running code? Or just interrupting the connections to the data sources?

Regards,

Dave.
 
Back
Top