Automatically add hyperlinks when typing a serial number

AliKaffe

New Member
Joined
Aug 28, 2020
Messages
14
Office Version
  1. 2013
Platform
  1. Windows
Hello!
I work for a company that sells and services pumps.
I am attempting to make a excel sheet that will give us an overview of the pumps we service and sell.
I would like to make a macro that will automatically add a hyperlink to a file with the same file name on our server when i type the serial number in column L.
So i would like it to search the folder we put our Servicereports in, and add a hyperlink to the file if it finds a text in that column that matches the file name in the folder.
if possible i would also like it to search sub folders.
Is this possible?

if you see the image, i already added some hyper link manually. But would like this to happen automatically when i create a file in the folder with the same name.

tine.png
 
i'm sorry. i don't understand how you added that function to a button or a keyboard shortcut.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Right click on your button - select "Assign Macro."
Note: When a procedure contains arguments, it will not appear in the list of available macros. You must type it in.

Here is an example of using OnKey: Control-Shift-R

VBA Code:
Private Sub Workbook_Activate()
    Application.OnKey "^+R", "Sheet1.TryAddLink"
End Sub

Private Sub Workbook_Deactivate()
    Application.OnKey "^+R", ""
End Sub

The example, "Auto Hyperlinker.xlsm", has been updated with the above.
 
Upvote 0
Hello!
Is it possible to change the hyperlinker to link to folders the same way it links to files?
 
Upvote 0
Hello!
Sorry for the late reply.
I basically want it to function exactly the same, just add a hyperlink for a folder with the same Name
 
Upvote 0
In the procedure GetFileList:
Change:
d.Add Key, File.Path
To:
d.Add Key, File.ParentFolder.Path
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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