Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel needs BROWSE in tools-options-general-default file location | Setting up and Configuration of Excel | |||
Need to browse 100's of file TITLES in Excel 2000 | Excel Discussion (Misc queries) | |||
Displaying HTML code in .CSV file Excel 2002 | Excel Programming | |||
excel vba browse file | Excel Programming | |||
excel vba browse file | Excel Programming |