ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to hide a workbook and to detect a hidden workbook in visual basic (https://www.excelbanter.com/excel-programming/297382-how-hide-workbook-detect-hidden-workbook-visual-basic.html)

jn1971[_3_]

How to hide a workbook and to detect a hidden workbook in visual basic
 
Hello Gurus!

I have 2 opened workbooks - deswkb & srcwkb. deswkb is the activ
workbook
1) my code to hide deswkb (i thought):
deswkb.Application.ActiveWindow.Visible = False
problem:
if i run the code again, the macro will close next activewindow whic
is srcwkb.
Question:
Is there anyway that I could code to hide deswkb and did not have thi
kind of problem?

2) I failed to detect the hidden workbook by using following codes:

If IsBookOpen("c:\excel97\Database1.xls") Then
Set deswkb = Workbooks("c:\excel97\Database1.xls")
Else
Set deswkb = Workbooks.Open("c:\excel97\Database1.xls")
End If
____when IsBookOpen is :
Function IsBookOpen(ByRef szBookName As String) As Boolean
On Error Resume Next
IsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
End Function
question:
Is there any way that I could code to detect it succesfully?

Any suggestions would be appreciated!

Tahnks, Jeani

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:18 PM.

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