B
BillyRogers
I have a program where I loop throught the worksheets in a folder and copy
the information from a worksheet called "Print_Recap".
There are a few workbooks in the folder that don't have this sheet and I
simply want to skip them and go on to the next workbook. The code i have
gives me an error message whenever it gets to a workbook without the
"Print_Recap" worksheet.
here's what I tried using but it doesn't work. I get error 9 subscript out
of range
Do While FNames <> ""
Set mybook = Workbooks.Open(FNames)
Dim SheetExists As Boolean
SheetExists = False
SheetExists = CBool(Len(mybook.Sheets("Print_Recap").Name))
If SheetExists Then
'some code to run goes here
Else
SheetExists = False
End If
Loop
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003
the information from a worksheet called "Print_Recap".
There are a few workbooks in the folder that don't have this sheet and I
simply want to skip them and go on to the next workbook. The code i have
gives me an error message whenever it gets to a workbook without the
"Print_Recap" worksheet.
here's what I tried using but it doesn't work. I get error 9 subscript out
of range
Do While FNames <> ""
Set mybook = Workbooks.Open(FNames)
Dim SheetExists As Boolean
SheetExists = False
SheetExists = CBool(Len(mybook.Sheets("Print_Recap").Name))
If SheetExists Then
'some code to run goes here
Else
SheetExists = False
End If
Loop
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003