+ Reply to Thread
Results 1 to 4 of 4

Check Excel's state to see if a workbook is loaded in App

  1. #1
    Chris w.
    Guest

    Check Excel's state to see if a workbook is loaded in App

    Does anyone know if there is a way to check Excel App. to
    see if there is actually a workbook open. I'm refferring
    to the conditon where Excel is open but there is no
    workbook open (loaded), I would like to cancel code from
    running if the App. has no loaded workbook

  2. #2
    Fredrik Wahlgren
    Guest

    Re: Check Excel's state to see if a workbook is loaded in App


    "Chris w." <[email protected]> wrote in message
    news:[email protected]...
    > Does anyone know if there is a way to check Excel App. to
    > see if there is actually a workbook open. I'm refferring
    > to the conditon where Excel is open but there is no
    > workbook open (loaded), I would like to cancel code from
    > running if the App. has no loaded workbook
    >


    I guess you could use the ActiveWorkbook property:
    http://msdn.microsoft.com/library/de...bjWorkbook.asp

    /Fredrik




  3. #3
    Dave Peterson
    Guest

    Re: Check Excel's state to see if a workbook is loaded in App

    How about:

    If ActiveWorkbook Is Nothing Then
    MsgBox "no active workbook"
    Exit Sub
    End If

    At the top of your procedure.

    "Chris w." wrote:
    >
    > Does anyone know if there is a way to check Excel App. to
    > see if there is actually a workbook open. I'm refferring
    > to the conditon where Excel is open but there is no
    > workbook open (loaded), I would like to cancel code from
    > running if the App. has no loaded workbook


    --

    Dave Peterson

  4. #4
    Walt Weber
    Guest

    Check Excel's state to see if a workbook is loaded in App

    Hi Chris,

    It's not clear how you've opened or are controlling this
    instance of Excel, but the following may help (It works as
    a sheet event within a workbook in Excel):

    Private Sub Worksheet_SelectionChange(ByVal Target As
    Range)
    MsgBox Application.Workbooks.Count
    End Sub

    App.Workbooks.Count may get you there.

    Best Regards,
    Walt

    >-----Original Message-----
    >Does anyone know if there is a way to check Excel App. to
    >see if there is actually a workbook open. I'm refferring
    >to the conditon where Excel is open but there is no
    >workbook open (loaded), I would like to cancel code from
    >running if the App. has no loaded workbook
    >.
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1