Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Excel workbook Return

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi all, One more question. I have a excel workbook that is linked to anouther excel workbook. When I Hit the Cmd button to go to the other workbook It opens fine, but when I want to end and close the work book it goes to the next (window app) I have open. Anyway to "on closing" to make it go back to the workbook that it is linked to ? Thx Dan

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Sydney/Brisbane , Australia
    Posts
    542
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What was the question?

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Dantb

    In the Workbook that is closing place this code in the Private Module of the Workbook, and change Book1.xls to the name of the Workbook you want to activate.

    Code:
    Option Explicit
    Dim bClose As Boolean
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
     bClose = Not Cancel
    End Sub
    
    Private Sub Workbook_Deactivate()
     On Error Resume Next
      If bClose = True Then Workbooks("Book1.xls").Activate
     On Error GoTo 0
    End Sub

    _________________
    Kind Regards
    Dave Hawley
    OzGrid Business Applications
    Microsoft Excel/VBA Training


    [ This Message was edited by: Dave Hawley on 2002-04-01 21:25 ]

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks again for your Help Dave. Have a good day. Dan

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
  •