+ Reply to Thread
Results 1 to 2 of 2

File Browse Function (Open dialog box for choosing file)

Hybrid View

  1. #1
    Registered User
    Join Date
    08-25-2005
    Posts
    1

    File Browse Function (Open dialog box for choosing file)

    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.

  2. #2
    Jake Marx
    Guest

    Re: 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.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1