Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Is file or workbook already open

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    83
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a workbook that loads a form and from this formn there are optionbuttons set thaif you click them they will open a specific file.
    The problem is when you re-click on these optionbuttons the message 'Do you want to re-open file. Re-opening file will.......'. It used to end the code but I have managed to put an 'onerror' command in VBA stopping the breaking of code but it still comes up with this message. Could you please tell me how to stop this message coming up or if there is another way of detecting if the file is already open and therefore only activating the workbook.

    Many thanks
    Steve

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Application.displayalerts=false

    ...will make sure no pop-up messages are shown.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Or to answer your second question, you can try the following:
    Code:
    On Error GoTo errorhandler
    Windows("Book2.xls").Activate
    Exit Sub
    errorhandler:
    Workbooks.Open "Book2.xls"
    Put this code where you have your buttons.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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