View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ladymuck Ladymuck is offline
external usenet poster
 
Posts: 45
Default Using Sub RDB_Merge_Data()

Thanks for the suggestion, I used Ron's as it tied in with his existing code
but I've kept this snippet as it's bound to come in useful in the future

"macropod" wrote:

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!