Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to lookup hyperlinked cells
I want to hyperlink several cells to pdf files. Then want to use
lookup function to return a cell and then print both the current wor sheet and the hyperlinked pdf file. Can this be done? thanks nei -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to lookup hyperlinked cells
Your solution would have to include a UDF (user-defined function) to return
the hyperlink address contained in the cell that has a hyperlink in it. Try the function below (I have been working on a more sophisticated version for the Else portion of the clause that will return the URL if the Link argument is a cell with a HYPERLINK function, but I don't have it fully debugged in the case of a nested function, etc.). Public Function HyperlinkURL(Link As Range) As Variant With Link If .Hyperlinks.Count 0 _ Then 'Return the URL of the hyperlink. HyperlinkURL = .Hyperlinks(1).Address Else 'Return #N/A! error value if none found. HyperlinkURL = CVErr(xlErrNA) End If End With End Function After printing the current worksheet, you would then have to use the Shell statement to execute a command line similar to the following "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" /p /h "%1" to print out the PDF file, where "%1" would be replaced by the hyperlink address returned by the function above. I am assuming that you have a command button that you want to click to print out the current worksheet, then fetch the address of the PDF document at the active cell, then print that out. Technically, you can't do that with a function. A function can only return a value to a cell, not perform actions that would be carried out by a command macro. -- Regards, Bill "neil kempinski " wrote in message ... I want to hyperlink several cells to pdf files. Then want to use a lookup function to return a cell and then print both the current work sheet and the hyperlinked pdf file. Can this be done? thanks neil --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linking Hyperlinked Cells | Excel Discussion (Misc queries) | |||
Lookup returns hyperlinked values as normal text | Excel Discussion (Misc queries) | |||
How can I sort hyperlinked cells? | Excel Discussion (Misc queries) | |||
set hyperlinked cells to always display at the top of the workshee | Excel Discussion (Misc queries) | |||
locked hyperlinked cells | Excel Discussion (Misc queries) |