LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Selecting a file in Windows Explorer

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
opening a file from windows explorer or the desktop, etc. Lance Napier Excel Discussion (Misc queries) 4 June 24th 08 03:27 AM
Creates new file when opening in windows explorer fund_dan Excel Discussion (Misc queries) 4 December 27th 07 08:23 PM
File Open Vs Opening from Windows Explorer [email protected] Excel Discussion (Misc queries) 0 September 7th 07 10:15 AM
Error when VB tries to open file from Windows Explorer JDaywalt Excel Programming 3 June 12th 07 05:03 AM
File info from Windows Explorer to Excel? Wordgeek Excel Discussion (Misc queries) 1 September 15th 05 02:58 PM


All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"