Load from folder handling no files found

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,895
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
  8. 2003 or older
Platform
  1. Windows
My project has a base set of data that is fixed with weekly update files that I place in another folder
These updates are same structure as base data so after loading I combine the 2 tables
I have used the generated code for select from folder for my csv files and all works well up until now
Today there were no updates so the folder was empty, how can I add another step to the load updates to stop it falling over with an error and effectively create an empty table as opposed to falling over and leaving last weeks updates in my table as my thinking would be any error trapping would halt any table refresh I need it to proceed
My other thinking would be deleting the table at the start of the script and handling the error to exit nicely
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
you could try this.
Create a table that just contains the column headings, no data (manual)
Make the final table that gets loaded something like this

= try csvLoadQueryName otherwise queryWithHeadingsOnlyName

The try function basically is IfNotError
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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