View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jn1971[_3_] jn1971[_3_] is offline
external usenet poster
 
Posts: 1
Default 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