View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Hyperlink 4 Opening More Than 1 File.

In cell A1 insert a hyperlink that jumps to cell A1. Clicking this will not
take us to anywhere new, just back to A1. It will however trip the
FollowHyperlink event. In the worksheet code area insert the following macro:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
' gsnuxx
Set r = ActiveCell
If r.Address < "$A$1" Then Exit Sub
Dim s As String
Application.EnableEvents = False
s = "file:///C:\A.xls"
ActiveWorkbook.FollowHyperlink (s)
s = "file:///C:\B.xls"
ActiveWorkbook.FollowHyperlink (s)
Application.EnableEvents = True
End Sub

The macro first makes sure we are at cell A1. It then does hyperlinks to
A.xls and B.xls
--
Gary''s Student - gsnu200755


"FARAZ QURESHI" wrote:

Thanx brother,

Can you give me a sample code, for example Cell(A1), when clicked, opens
C:\A.xls and C:\B.xls

By the way can one use the Hyperlink() function for two?

"Gary''s Student" wrote:

Using VBA, the hyperlink jump can be intercepted by a macro and the macro can
open any number of hyperlinks.
--
Gary''s Student - gsnu200755


"FARAZ QURESHI" wrote:

Hi friends,

Any idea how to write up a Hyperlink in excel, which, when clicked, opens up
two files?

All help is appreciated!

Thanx!