Hyperlink customer in another workbook to a file

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Can you advise please how i hyperlink a customers name to a file in another workbook & from another workbook.
I am currently using this code below which works fine BUT i need to have the worksheet open & then select customer in question for it to hyperlink.

In another workbook i have the customers name in a worksheet cell,so my plan is to make the hyperlink happen from here without having to close one workbook then open another then run the code below.

Some info for you.
The open workbook is called DISCO CALC
The worksheet in use is called PRINT LABELS
The cell where the customers name is at is B3

Example on how it should work.
Using the info above look in cell B3 for the customers name & in this case it is TOM JONES 002
The code then looks at my other closed workbook / worksheet where the names are located.
The workbook is called DR.xlsm
The worksheet is called POSTAGE
Using the xlup code look in column B for TOM JONES 002, in all cases the customers name will only be within the last few entries.
Once found hyperlink it.
The stored file location path is C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF

Majority of what you need is above but its working from another workbook im stumped with

VBA Code:
Private Sub HyperlinkDisco_Click()
 Const FILE_PATH As String = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\"
        If ActiveCell.Column = Columns("B").Column Then
          
        If Len(Dir(FILE_PATH & ActiveCell.Value & ".pdf")) Then
        ActiveCell.Hyperlinks.Add Anchor:=ActiveCell, Address:=FILE_PATH & ActiveCell.Value & ".pdf"
        With ActiveCell
        .Font.Size = 12
        End With
        MsgBox "HYPERLINK WAS SUCCESSFUL.", vbInformation, "POSTAGE SHEET HYPERLINK MESSAGE"
        End If
        
        Else
        MsgBox "PLEASE SELECT A CUSTOMER FIRST TO HYPERLINK THE FILE.", vbCritical, "POSTAGE SHEET DISCO II HYPERLINK MESSAGE"
        Exit Sub
        End If
        
        If Dir(FILE_PATH & ActiveCell.Value & ".pdf") = "" Then
        If MsgBox("THERE IS NO FILE FOR THIS CUSTOMER" & vbNewLine & "WOULD YOU LIKE TO OPEN THE DISCO II FOLDER ?", vbYesNo + vbCritical, "HYPERLINK CUSTOMER DISCO II MESSAGE.") = vbYes Then
        CreateObject("Shell.Application").Open ("C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\")
    
    End If
    End If
End Sub
 
Your posting ays:

Hyperlink customer in another workbook to a file​


My script searches for a specific word on another sheet in the same workbook.

A Hyperlink is a completely different thing.

If you want a hyperlink
Right click on any cell and choose Link.
Then you should see what else to do.

Then next time you click on that cell you will be taken to the sheet and cell you wanted
 
Upvote 0
Solution

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I have understood what to code does.
I wanted to use it to find a match then i open another workbook.
I have now done it.
 
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,168
Members
452,615
Latest member
bogeys2birdies

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