Autolink

pnasz

New Member
Joined
Apr 16, 2012
Messages
19
i have image code 02-71234
which i want to autolink to the folder on the network.
Folder contain lot of file but i want to open the file related to the image code, for example for code 02-71234 i want to open the file 02-71234 (20.4 grams) which is present in a directory
 
\\main folder\folder1\folder2\folder3\1001-001.jpg

i am trying to find this file on the network its displaying message file not found.
 
Upvote 0
can i use this file as add ins or i have to save this file as macro rich file

As written, you would need to save as a macro-enabled file .xlsm or .xls.

If you save the file without macros (xlsx), any hyperlinks created would still work. You just wouldn't have the functionality of making new hyperlinks automatically.
 
Upvote 0
its working thanx a lot.

In the excel sheet in the cell its showing the link with the path of file.
Is it possible to show only file name with link.


You could add the lines shown in Blue font...

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Const sPath = "C:\TEST\"
    Dim sFilename As String, sCode As String
[COLOR="Blue"]    Dim vFilename As Variant[/COLOR]
    
    sCode = Target.Text
    
    If Intersect(Target, Columns("A")) Is Nothing Or _
        Target.Count > 1 Or _
        sCode = vbNullString Then Exit Sub
        
    On Error GoTo CleanUp
    Application.EnableEvents = False
            
    sFilename = FindFileMatch(sPath, sCode & "*")
    If sFilename = vbNullString Then
        MsgBox "No matching files found for code " & sCode
    Else
[COLOR="Teal"]        '--Optional: to display filename w/o path[/COLOR]
[COLOR="Blue"]        If InStr(1, sFilename, "\") > 0 Then
             vFilename = Split(sFilename, "\")
             sFilename = vFilename(UBound(vFilename))
        End If[/COLOR]
        
        Me.Hyperlinks.Add _
            Anchor:=Target, Address:=sFilename, _
            TextToDisplay:=sFilename
    End If
CleanUp:
    Application.EnableEvents = True
End Sub
 
Upvote 0
thanx a lot for your reply.
i am facing one more problem locating file with a name

02-80001 (17.3 grms ) this is excel file and i am typing 02-80001 in the target cell
but its hanging the excel sheet is this because of space between
02-80001 and (17.3 grms)
 
Upvote 0
thanx a lot for your reply.
i am facing one more problem locating file with a name

02-80001 (17.3 grms ) this is excel file and i am typing 02-80001 in the target cell
but its hanging the excel sheet is this because of space between
02-80001 and (17.3 grms) or something else

please help me
 
Upvote 0
its showing as for example file name 123001

123001.jpg and link is not working

i only want file name to be displayed like 123001 and link should work
 
Upvote 0
Hello JS411,

Your post number 13 works very well but the file name change in the cell with all path to the filename. The link is OK.
I tested your post number 25 which leaves the file name unchanged but the link does not work. Can you help me?

Thank you.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top