Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a worksheet with four columns A-D, column A has an ID number, B has description, C has location and D has a link to an image of the item. I have a short macro that ask the user for an ID# and searches column A for it. Once the ID is found a message box is displayed that includes the location of the tooling. I would like the hyperlink in Column D to open in a new window upon selecting the "Okay" button on the message box. Is this possible? Any help is greatly appreciated.

Here's what I have so far.

Dim FindString As String
Dim Rng As Range
 FindString = InputBox("Enter Tooling ID#")
  If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("A:A") 
    Set Rng = .Find(What:=FindString, _
                    After:=.Cells(.Cells.Count), _
                    LookIn:=xlValues, _
                    LookAt:=xlWhole, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlNext, _
                    MatchCase:=False)
    If Not Rng Is Nothing Then
        Application.Goto Rng, True 'value found
        MsgBox "Tooling " & Rng & " is located at " & Rng.Offset(, 2).Value & "."

    Else
        MsgBox "Tooling not found" 'value not found
    End If
  End With
End If

Thanks again.

share|improve this question
 
This looks like it could be done with if, vlookup, and hyperlink worksheet functions, without any macros at all. eg. =if(not(iserr(vlookup(E1,A:C,3,false))),hyperlink(vlookup(E1,A:C,3,false),"Tooli‌​ng is found at " &vlookup(E1,A:C,3,false)),"Tooling not found"), where e1 is where the user would enter the tooling ID# –  RowanC Jul 25 at 3:21
add comment

1 Answer

To follow a Hyperlink and open it in a new window (True):

    Range("A8").Hyperlinks(1).Follow (True)

It should open in the appropriate application.

Hyperlink.Follow

If if is not configured to open in the appropriate application, then you might read the link-address from the cell and investigate using Shell to start, for example, Paint:

Shell "MSPaint ""F:\Documents and Settings\student\My Documents\My Pictures\blog1.png"""
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.