Load from folder handling no files found

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,878
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,216,500
Messages
6,131,016
Members
449,615
Latest member
Nic0la

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