Run-time error 1004 - file took too long to refresh?

CoconutP

New Member
Joined
Aug 11, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi, my VBA code opens a number of Excel files and refresh them, but some files take longer than others to refresh, and one or two of these files always causes this Run-time error 1004. Eventhough the attached image shows the error saying it couldn't get data from the external data source, I think the issue really has to do with the refresh going over VBA's tolerance limit and VBA just shuts down and give up. When I refreshed this same file manually, the file refreshed ok but took 3 minutes. Is there a way to insert a line in the code to force the code to give it more time to refresh the file?
 

Attachments

  • Run time Error 1004.PNG
    Run time Error 1004.PNG
    5.9 KB · Views: 4

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
If you know which files the workbooks you open fetch their updates from then you might open these files before starting the updating process, that will be much much faster

I don't know if (and how) you could modify the vba behaviour

Bye
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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