View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
Rob[_26_] Rob[_26_] is offline
external usenet poster
 
Posts: 7
Default "Folder Select" Dialogue - Opening multiple files from selected folder

Hello Mike

Thanks for the response, unfortunately that didn't quite work either
(same error), but it got me thinking on a different track... I now
have a better understanding of what's going on with the whole
'function' malarkey. I have made it work now by using the following
code:

(Same declarations)
------------------------
Sub Test()
Dim filepath As String
filepath = SelectFolder(filepath)
Workbooks.OpenText Filename:= _
filepath + "\abc.txt", Origin:=xlMSDOS, StartRow:=1, _
(etc...)
EndSub
------------------------
(Same Function)

This brings the string into the Subroutine and avoids the whole
"Compile Error: Argument not optional", the thing I still don't
understand is what goes into the brackets after the folder (the
'argument' ), it seems I can put anything in there and it works out the
same (so long as it's qualified as speech - SelectFolder("anything you
want") - or a variable). I suppose it's because whatever is in there
isn't used by the function.

So anyway, it works. Thanks again for your input.

Rob
ß-)