Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Browse up to file

I am writing an excel macro that requires a user to input the path of a
file. I have code to ensure that the file actually exits but would
prefer to have a buttont that pops up a windows that allows the user to
BROWSE up to the file and when he follows the path and eventually
double clickson the file it stores that path instead of him having to
type it into a cell/input box somewhere.

Can anyone help with this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Browse up to file

What version of Office are you using? For Office 2003 (from help file!):

Sub UseFileDialogOpen()

Dim lngCount As Long

' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False ' only allow one file selection (True-
allow multiple file selections)
.Show

' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
MsgBox .SelectedItems(lngCount)
Next lngCount

End With

End Sub

For prior versions I have resorted to using:

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Do a search for OPENFILENAME to get the structure of the object. I can
provide you a sample via email if you can't find it.


"kaiser" wrote in message
oups.com...
I am writing an excel macro that requires a user to input the path of a
file. I have code to ensure that the file actually exits but would
prefer to have a buttont that pops up a windows that allows the user to
BROWSE up to the file and when he follows the path and eventually
double clickson the file it stores that path instead of him having to
type it into a cell/input box somewhere.

Can anyone help with this?



Reply
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
Browse File for Mac John Vickers Excel Discussion (Misc queries) 1 February 17th 06 06:23 PM
can't browse file k_anucha Excel Discussion (Misc queries) 1 September 29th 05 01:51 AM
File Browse Function (Open dialog box for choosing file) b-123 Excel Programming 1 August 25th 05 10:06 PM
excel vba browse file jazzy Excel Programming 3 August 5th 04 09:30 PM
File Browse Box JONNIE Excel Programming 2 February 5th 04 05:22 PM


All times are GMT +1. The time now is 12:25 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"