PDA

View Full Version : TREE hYPERLICK UPDATE



alan6449
11-22-2007, 12:26 AM
hi, im newbie using VBA.i need to design that,every time user change directory in excel,then the hyperlink we assign to the cell will automatically change to that folder.do anybody can help me .plz

Bob Phillips
11-22-2007, 01:28 AM
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Hyperlinks.Add Anchor:=Selection, _
Address:=.Value, _
TextToDisplay:=.Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.


__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

alan6449
11-22-2007, 01:42 AM
tq very much.i try to execute .but nothing happen.can u guide me the step.thanks again

Bob Phillips
11-22-2007, 02:11 AM
Type the link in cell H1 and it should auto-hyperlink


__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

alan6449
11-22-2007, 06:38 PM
i would to design code that update the hyperlink everytime user change the folder.like we assign userform,that user need to key in the folder that consist information at(C:\Documents and Settings\asrul\Desktop\AP note).later all hyperlink data(C:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).so that whenver user change folder like E:\Documents and Settings\asrul\Desktop\AP note) and the hyperlink data in cell also will be like (E:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).Is it possible.i need help.plz

alan6449
11-22-2007, 08:36 PM
i would to design code that update the hyperlink everytime user change the folder.like we assign userform,that user need to key in the folder that consist information at(C:\Documents and Settings\asrul\Desktop\AP note).later all hyperlink data(C:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).so that whenver user change folder like E:\Documents and Settings\asrul\Desktop\AP note) and the hyperlink data in cell also will be like (E:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).Is it possible.i need help.plz