+ Reply to Thread
Results 1 to 2 of 2

navigating and closing workbooks

  1. #1
    Forum Contributor
    Join Date
    03-11-2005
    Posts
    115

    navigating and closing workbooks

    Does anyone know of some code I could use to close the file whenever I navigagate away via a hyperlink.

    For example: workbook1 links to workbook2. In workbook2 you can navigate back to workbook1 using a hyperlink, however workbook2 is still left open.
    I want workbook2 to close whenever you go back to workbook1.

    Can anyone help ?!

    Thanks

    Amy xx

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Amy,

    Here is the code your looking for...

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

    For I = 1 To Hyperlinks.Count
    If Hyperlinks(I).Range.Address = Target.Address Then
    Beep
    ThisWorkbook.Close
    End If
    Next I

    End Sub


    If you have questions you know where to reach me.

    Sincerely,
    Leith Ross

+ 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