View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Count open workbooks before closing

I don't, I get the correct answer!!

Mike

"Les" wrote:

Hi all, i am not a programmer but a dabbler and i am really stuck with
counting the open workbooks. I have a search programme in excel and i have in
the beginning of the code the following "Application.IgnoreRemoteRequests =
True" when i open other workbooks, no matter how many are open i always get
only 2 open with the code below ??

Sub chkWkb()

Dim wkb As Integer
Application.IgnoreRemoteRequests = False
Application.DisplayAlerts = True

wkb = Application.Workbooks.Count
If wkb < 2 Then
Application.Quit
Else
ActiveWorkbook.Close
End If

End Sub


Am i missing someghing here ??

--
Les