+ Reply to Thread
Results 1 to 4 of 4

VBA code to check if another window is open?

  1. #1
    jweasl
    Guest

    VBA code to check if another window is open?

    I need to check if another window is open - if not I am going to display a
    dialog box letting them know to open the file (or possibly opening a browse
    window for them to open it), and if so, just keep going

  2. #2
    Jim Thomlinson
    Guest

    RE: VBA code to check if another window is open?

    Just to confrim you want to know if another file is open? If it is not open
    then why not just open it yourself, something like this...

    dim wbk as workbook

    on error resume next
    set wbk = workbooks("MyBook.xls")
    on error goto 0
    is wbk is nothing then _
    set wbk = workbooks.open("Mybook.xls")

    --
    HTH...

    Jim Thomlinson


    "jweasl" wrote:

    > I need to check if another window is open - if not I am going to display a
    > dialog box letting them know to open the file (or possibly opening a browse
    > window for them to open it), and if so, just keep going


  3. #3
    jweasl
    Guest

    RE: VBA code to check if another window is open?

    Ok, I tried modifying the code to give a msgbox saying "Open Quote System" if
    the window is not found - but it says that if the window is found or not.
    I guess I'm not sure of the exact wbk property - the file is a template
    (Quote System.xlt), when opened the default is Quote System1 - but I set wbk
    to Quote System1 and Quote System1.xls, it didn't work either time.

    "Jim Thomlinson" wrote:

    > Just to confrim you want to know if another file is open? If it is not open
    > then why not just open it yourself, something like this...
    >
    > dim wbk as workbook
    >
    > on error resume next
    > set wbk = workbooks("MyBook.xls")
    > on error goto 0
    > is wbk is nothing then _
    > set wbk = workbooks.open("Mybook.xls")
    >
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "jweasl" wrote:
    >
    > > I need to check if another window is open - if not I am going to display a
    > > dialog box letting them know to open the file (or possibly opening a browse
    > > window for them to open it), and if so, just keep going


  4. #4
    jweasl
    Guest

    RE: VBA code to check if another window is open?

    This code doesn't work either

    If Windows("Quote System1").Visible = True Then MsgBox "Visible" _
    Else MsgBox "Not Visible"

    If the window is open, it will give a msgbox saying "Visible", but if it's
    not open it gives me an error - Subscript out of range.


    "jweasl" wrote:

    > Ok, I tried modifying the code to give a msgbox saying "Open Quote System" if
    > the window is not found - but it says that if the window is found or not.
    > I guess I'm not sure of the exact wbk property - the file is a template
    > (Quote System.xlt), when opened the default is Quote System1 - but I set wbk
    > to Quote System1 and Quote System1.xls, it didn't work either time.
    >
    > "Jim Thomlinson" wrote:
    >
    > > Just to confrim you want to know if another file is open? If it is not open
    > > then why not just open it yourself, something like this...
    > >
    > > dim wbk as workbook
    > >
    > > on error resume next
    > > set wbk = workbooks("MyBook.xls")
    > > on error goto 0
    > > is wbk is nothing then _
    > > set wbk = workbooks.open("Mybook.xls")
    > >
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "jweasl" wrote:
    > >
    > > > I need to check if another window is open - if not I am going to display a
    > > > dialog box letting them know to open the file (or possibly opening a browse
    > > > window for them to open it), and if so, just keep going


+ 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