Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That worked great! Thank you very much!
Frank On Sun, 19 Aug 2007 09:10:00 -0700, JLatham <HelpFrom @ Jlathamsite.com.(removethis) wrote: Add a forms button and attach this macro code to it? Or if you're using the control toolbox, then just cut the actual code from this and paste it into the button's _Click event code. You could change ActiveCell to a specific sheet/cell if you want. Sub MakeHyperlinkFromFileOpen() 'select the cell you want the hyperlink 'placed into before calling this macro Dim hyperlinkPath As String Dim displayedText As String hyperlinkPath = Application.GetOpenFilename If hyperlinkPath = "False" Then Exit Sub End If 'if cell has text in it already, use that 'as the TextToDisplay value If Not IsEmpty(ActiveCell) Then displayedText = ActiveCell.Value Else displayedText = hyperlinkPath End If ActiveSheet.Hyperlinks.Add Anchor:=Selection, _ Address:=hyperlinkPath, _ TextToDisplay:=displayedText End Sub "Phrank" wrote: Hi, I have a userform that pops up, and the information entered by the user gets entered into an Excel workbook. I would like to be able to add an option (a button?) to the form that enables the user to open a Windows Explorer window and select a file (on a network drive). I would then like for a hyperlink to the selected file be copied to the workbook. I've read several entries on the GetOpenFilename function, but can't figure out how to work this into a hyperlink variable to be added to the end workbook. I'd appreciate any help with this. Thanks. Frank |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
opening a file from windows explorer or the desktop, etc. | Excel Discussion (Misc queries) | |||
Creates new file when opening in windows explorer | Excel Discussion (Misc queries) | |||
File Open Vs Opening from Windows Explorer | Excel Discussion (Misc queries) | |||
Error when VB tries to open file from Windows Explorer | Excel Programming | |||
File info from Windows Explorer to Excel? | Excel Discussion (Misc queries) |