Hyperlink Help

G

Guest

I want to link 2 (or more....well okay, closer to 100!) excel workbooks
stored in different files using hyperlinks. Is there any macro or way that I
can click on the hyperlink, go to the new workbook, and close the old
workbook? I can hyperlink just fine, but it keeps opening up a new, seperate
excel sheet with each new workbook I open, and it clutters up my taskbar.
 
G

Guest

If the Hyperlink is at cell C22. I would add a button for each Hyperlink
that would call a macro similar to the one below.

Sub HperlinkandClose()
'
' Macro3 Macro
' Macro recorded 3/10/2007 by jwarburg
'

'
Set oldworkbook = ThisWorkbook

Range("C22").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

oldworkbook.Close SaveChanges:=True
End Sub
 
G

Guest

I found a better way of closing the file. Put this code into the old
workbook in the
VBA Thsiworkbook module. You can make savechanges either true or false

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, _
ByVal Target As Hyperlink)

ThisWorkbook.Close savechanges:=True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top