ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Windows Visible Property - Code Help (https://www.excelbanter.com/excel-discussion-misc-queries/156982-windows-visible-property-code-help.html)

Gerry O

Windows Visible Property - Code Help
 
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.
--
Thanks,

Gerry O.

Jim Thomlinson

Windows Visible Property - Code Help
 
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...
--
HTH...

Jim Thomlinson


"Gerry O" wrote:

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.
--
Thanks,

Gerry O.


Gerry O

Windows Visible Property - Code Help
 
Thanks, again!

--
Thanks,

Gerry O.


"Jim Thomlinson" wrote:

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...
--
HTH...

Jim Thomlinson


"Gerry O" wrote:

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.
--
Thanks,

Gerry O.



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com