View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default GetOpenFilename path vs filename

You want this to happen after the dialog, before opening the file ?

Sub test()
Dim V As Variant, S As String
V = Application.GetOpenFilename
If V = False Then Exit Sub
S = CStr(V)
MsgBox S
MsgBox Left$(S, InStrRev(S, "\") - 1)
MsgBox Mid$(S, InStrRev(S, "\") + 1)
End Sub


HTH. Best wishes Harald

"Bob Zimski" wrote in message
...
Not sure what to do with the below. Seems no matter what I do, it keeps
giving back the information for the Personal.xls file. I presume perhaps
there is something I am supposed to do beforehand?



"jaf" wrote:

Hi Bob,
The middle one is what your looking for.

Debug.Print ThisWorkbook.FullName, ThisWorkbook.Name, ThisWorkbook.Path

John

"Bob Zimski" wrote in message
...
Depending on which directory a user picks his file, the processing
routines
will vary. This means I would need to be able to evaluate the path of
the
file that was chosen and run the appropriate subroutine. I would also
like to
be able to evaluate the filename as well. The problem I am having is
that the
GetOpenFilename returns the path and filename together. Ideally I'd
like to
break it into two strings to evaluate both of them before proceeding.

Any help appreciated.