How do you ignor File Not Found Dialog Popup ?

D

Dan Thompson

Workbooks("Master.xls").Worksheets("UpdatedList").Cells(rw, 2).FormulaR1C1 =
"='[" & FileName & "]PointCount'!R2C5"

The above is my line of code that inserts a formula into a cell in my
Master.xls workbook the formula links to a value in the worksheet called
PointCount from multiple different workbooks. the problem is that if the
program encounters a workbook that does not have a worksheet named
"PointCount" I get a pop up FileNotFound window asking me to browse to the
file that has the worksheet "PointCount" I do not want it to do this. Is
there a way to have my macro skip over these files or suppres the "File Not
Found" Pop up from poping up ?
 
R

Ron de Bruin

Hi Barb

Dan want to test the worksheet name, not the workbook name

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


Barb Reinhardt said:
I think I'd use the FileExists method to determine if the file did exist
before entering the formula in a cell.

http://msdn.microsoft.com/en-us/library/x23stk5t(VS.85).aspx

when I use it, I enter the full path in filespec. I've tweaked the code to
make the function return a boolean TRUE/FALSE and execute other actions based
on that result.
--
HTH,

Barb Reinhardt



Dan Thompson said:
Workbooks("Master.xls").Worksheets("UpdatedList").Cells(rw, 2).FormulaR1C1 =
"='[" & FileName & "]PointCount'!R2C5"

The above is my line of code that inserts a formula into a cell in my
Master.xls workbook the formula links to a value in the worksheet called
PointCount from multiple different workbooks. the problem is that if the
program encounters a workbook that does not have a worksheet named
"PointCount" I get a pop up FileNotFound window asking me to browse to the
file that has the worksheet "PointCount" I do not want it to do this. Is
there a way to have my macro skip over these files or suppres the "File Not
Found" Pop up from poping up ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top