Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want to check if a list of workbooks are open and if not open them. Could someone help me? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On the fly:
Dim WorkbookNames() as Variant Dim wb as Workbook Dim i as Integer WorkbookNames = array("Workbook1.xls", "Workbook2.xls", "Worbook3.xls") For i = 0 to Ubound(WorkbookNames) On Error Resume Next Set wb = Workbooks(WorkbookNames(i)) If wb Is Nothing Then Workbooks.Open WorkbookNames(i) End If Next i On Error Goto 0 Set wb = Nothing "Ricardo Silva" wrote: Hi, I want to check if a list of workbooks are open and if not open them. Could someone help me? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI Eric,
Thanks for the tip; however this routine is constantly open the array that is defined Some workbooks have links and they were previously open I receive a message that Reopening the workbook will discard all changes done. Is there a way to avoid reopening it? In the other hand can the array be = to all files linked to the active workbook? Thanks for you help. Ricardo "Eric White" wrote: On the fly: Dim WorkbookNames() as Variant Dim wb as Workbook Dim i as Integer WorkbookNames = array("Workbook1.xls", "Workbook2.xls", "Worbook3.xls") For i = 0 to Ubound(WorkbookNames) On Error Resume Next Set wb = Workbooks(WorkbookNames(i)) If wb Is Nothing Then Workbooks.Open WorkbookNames(i) End If Next i On Error Goto 0 Set wb = Nothing "Ricardo Silva" wrote: Hi, I want to check if a list of workbooks are open and if not open them. Could someone help me? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
When I open Excel, workbooks open automatically. How can I stop t | Excel Discussion (Misc queries) | |||
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. | Excel Programming | |||
Check for open workbooks | Excel Programming | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Workbooks.Open / .Open Text - How do you stop the .xls addition? | Excel Programming |