I can't make visible a Workbook that I opened using GetObject().
Somebody suggested using the code below:
Dim DB_Workbook As Workbook
On Error Resume Next
Set DB_Workbook = GetObject("C:\Full\Path\To\Workbook.xls")
If Err.Number = 432 Then
MsgBox "Workbook not open."
Else
MsgBox "Workbook open."
End If
DB_Workbook.Application.Visible = True
First, when I run that code, then even when the workbook happens to be
closed, GetObject() always opens it -- so MsgBox "Workbook not open."
is never called -- which is fine by me.
But the main thing is that I get a phenomenon I have already bumped
into. When GetObject() finds that DB_Workbook is not open, and so it
opens it, then, I can access the DB Excel file contents through
another Excel app that I have written (my "Viewer"), but:
- the DB_Workbook remains invisible
- the DB_Workbook does not appear in the Windows task list
So now the next thing I want to be able do, since I am debugging, is
to make the Excel DB_Workbook visible. So I tried coding:
DB_Workbook.Application.Visible = True
But it does not make the DB_Workbook visible. As a matter of fact, I
see from the IDE that DB_Workbook.Application.Visible was already set
to True.
Ideas?