Windows Visible Property - Code Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code in workbook open event that hides the window and just shows the
userform that opens up. The code is as follows:

Windows("ABS Open2.xls").Visible = False

I'd like to replace typing the actual filename with code to use the full
path of the file so I can easily use this code in other workbooks but can't
seem to get the syntax correct.

Would appreciate help with the above or alternates.
 
The reference (index) to the Window does not include the full path to the
file so you are barking up the wrong tree on that one. Here is something
similar you could try...

Dim wnd As Window

Set wnd = ActiveWindow
wnd.Visible = False
MsgBox "It's Gone"
wnd.Visible = True
MsgBox "It's Back"

It sets an object (wnd) to the active window. Now I can reference that
window directly without having to know it's name...
 
Thanks, again!

--
Thanks,

Gerry O.


Jim Thomlinson said:
The reference (index) to the Window does not include the full path to the
file so you are barking up the wrong tree on that one. Here is something
similar you could try...

Dim wnd As Window

Set wnd = ActiveWindow
wnd.Visible = False
MsgBox "It's Gone"
wnd.Visible = True
MsgBox "It's Back"

It sets an object (wnd) to the active window. Now I can reference that
window directly without having to know it's name...
 
Back
Top