Hi,
I want to check if a list of workbooks are open and if not open them.
Could someone help me?
Hi,
I want to check if a list of workbooks are open and if not open them.
Could someone help me?
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?
>
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?
> >
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks