Excel File is Valid

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance!

In one of my folders I have the following files:

"~$San James---CREA LC.xlsm"
"Book1.xlsx"
"Paula Smith---COL GC.xlsm"
"~$Rams Dyz---GPOA.xlsm"

I am using a macro to list all the files whithin a specific folder and then to get the data contained in one of their sheet's.
I am doing this NOT opening the file, and Works FINE!

my problem comes when one of my clients send me this files and when I do try to open or to extarct the data contained in eg the file:
"~$San James---CREA LC.xlsm"

I get the following message:
Excel cannot open the file xxx because the file format or file extension is not valid. Verify the file has not been corrupted and that the file extension matches the format of the file.


When listing the files I could avoid this kind of files easy, because those file's FileLen is < 5KB. or because left(TheFile,1)="~"

BUT...

is the any way to check if a Excel File is Valid using a code line like eg:

Code:
 if Fx_bFileIsOK("C:~$San James---CREA LC.xlsm") then...


Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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