LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default File Browse Function (Open dialog box for choosing file)

Hi b-123,

Something like this should work for you:

Sub Demo()
Dim vFilePath As Variant

vFilePath = Application.GetOpenFilename(FileFilter:= _
"Microsoft Excel Files (*.xls), *.xls", Title:= _
"Please select a file to hyperlink.")

If vFilePath < False Then
With Sheet1
.Hyperlinks.Add Anchor:=.Range("A1"), _
Address:=vFilePath
End With
End If
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


b-123 wrote:
Hi all-

I tried searching through the forum but couldn't find answer:

I want to add a command button to a form where if a user clicks it a
file browse window comes up (like for opening a file) and if a user
navigates through and selects a file I assign the path to this file as
a hyperlink to an entry in a spreadsheet - so that a future user can
open this file just by clicking on the link.

I learned how to assign hyperlink by doing a macro record, but do not
know how to incorporate file browse function. any help would be much
appreciated.

 
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
Open Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
using Windows API Open Dialog/Browse in VBA - center form in scree Philip Excel Programming 1 April 19th 05 02:15 PM
File Open Dialog scantor145[_3_] Excel Programming 1 September 29th 04 12:04 AM
Dialog For Choosing A File as a string Gjones Excel Programming 2 April 13th 04 07:11 PM
open file dialog-select file-import worksheet Divinedar Excel Programming 1 January 16th 04 07:13 PM


All times are GMT +1. The time now is 02:40 PM.

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"