Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    79

    Unanswered: A macro code to check whether any workbook is currently open or not.

    Hi All,

    I have created some toolbars for essbase connection. I won't a macro which will check whether there is any workbook which currently open or not. If there is no workbook open then macro should have code line which will show a message to the user that there is no workbook currently open and he can't run a macro. I have got a macro which check whether a particular workbook is open or not but it becomes specific because i will have to mention the name of the workbook. I want a macro code which will check whether any workbook is open or not. Please expedite. Thanks a lot for your help in advance.

  2. #2
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Hi,

    I think the first thing I would try is:
    Code:
        If ActiveWorkbook Is Nothing Then
     
            MsgBox "No workbook currently active"
     
        End If
    I suggest this rather than checking Workbooks.Count in case a user has Personal.xls

    Have a play around with it to see if there are any caveats?

    Hope that helps...

  3. #3
    Join Date
    Sep 2009
    Posts
    79

    A macro code to check whether any workbook is currently open or not.

    Thanks a lot. It's working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •