View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 293
Default Using Sub RDB_Merge_Data()

Hi Ladymuck,

At its simplest"

MyPath = InputBox("Please enter the filepath")
For something more sopisticated, giving the user the ability to browse to the folder, create a funtion coded as:
Function GetFolder(Optional Title As String, Optional RootFolder As Variant) As String
On Error Resume Next
GetFolder = CreateObject("Shell.Application").BrowseForFolder( 0, Title, 0, RootFolder).Items.Item.Path
End Function

Then you can use:
MyPath = GetFolder(Title:="Find a Folder", RootFolder:=&H11)

Note that there's no error-checking in the above examples.

--
Cheers
macropod
[MVP - Microsoft Word]


"Ladymuck" wrote in message ...
I'm using Ron de Bruin's great bit of code to compile data. However, I need
the MyPath value to be dynamically generated as the source folder will vary
according to the user running the macro. How would I amend the code so that
it does not rely on a hard coded value?

Many thanks!