Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Browse for file name code? (Excel 2002 VBA)

Hello. I need to create a macro that displays a browser window, lets
the user choose a folder and then a filename within the folder, and
updates all the links in the file to that found file. I wrote the code
that updates the links but I am struggling creating code that lets the
user choose the folder and filename. Searching around I found the
following code. It works wonderfully allowing the user to select a
folder. But how do I make it display the filenames within a folder and
let the user select one? Thanks for any help!
http://www.cpearson.com/excel/BrowseFolder.htm

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Browse for file name code? (Excel 2002 VBA)

application.Dialogs(xlDialogFindFile).Show
might be what you need.

" wrote:

Hello. I need to create a macro that displays a browser window, lets
the user choose a folder and then a filename within the folder, and
updates all the links in the file to that found file. I wrote the code
that updates the links but I am struggling creating code that lets the
user choose the folder and filename. Searching around I found the
following code. It works wonderfully allowing the user to select a
folder. But how do I make it display the filenames within a folder and
let the user select one? Thanks for any help!
http://www.cpearson.com/excel/BrowseFolder.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Browse for file name code? (Excel 2002 VBA)


try

Dim sFile As String
sFile$ = Application.GetOpenFilename

you will still to add code to open the file

for save as try

sFile$ = Application.GetSaveAsFilename


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=536692

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Browse for file name code? (Excel 2002 VBA)

One more option, available I think only in 2002 and later. It lets you set
an initial file:

Sub test()
Dim file_dialog As FileDialog

Set file_dialog = Application.FileDialog(msoFileDialogOpen)
With file_dialog
.AllowMultiSelect = False
.Title = "Pick a File to Link to if You Dare"
.ButtonName = "Link"
.InitialFileName = "C:\Documents and Settings\Doug\My Documents"
.Show
If .SelectedItems.Count = 1 Then
MsgBox .SelectedItems(1)
End If
End With
End Sub


--
Doug


wrote in message
ups.com...
Hello. I need to create a macro that displays a browser window, lets
the user choose a folder and then a filename within the folder, and
updates all the links in the file to that found file. I wrote the code
that updates the links but I am struggling creating code that lets the
user choose the folder and filename. Searching around I found the
following code. It works wonderfully allowing the user to select a
folder. But how do I make it display the filenames within a folder and
let the user select one? Thanks for any help!
http://www.cpearson.com/excel/BrowseFolder.htm



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Browse for file name code? (Excel 2002 VBA)

Thanks for the ideas, but I searched a little more and found
Application.FileDialog to use instead of all that code. It's exactly
what I need.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Browse for file name code? (Excel 2002 VBA)

As long as you recognize that application.filedialog only works in xl2002 and
later.



--
Regards,
Tom Ogilvy


" wrote:

Thanks for the ideas, but I searched a little more and found
Application.FileDialog to use instead of all that code. It's exactly
what I need.


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
Excel needs BROWSE in tools-options-general-default file location Homer Setting up and Configuration of Excel 2 November 6th 05 10:46 PM
Need to browse 100's of file TITLES in Excel 2000 jeffbro27707 Excel Discussion (Misc queries) 3 May 2nd 05 08:46 PM
Displaying HTML code in .CSV file Excel 2002 killerinstinct Excel Programming 0 September 20th 04 11:00 AM
excel vba browse file jazzy Excel Programming 0 August 5th 04 10:07 PM
excel vba browse file jazzy Excel Programming 3 August 5th 04 09:30 PM


All times are GMT +1. The time now is 04:26 PM.

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

About Us

"It's about Microsoft Excel"