View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.programming
Stefan Mueller[_2_] Stefan Mueller[_2_] is offline
external usenet poster
 
Posts: 20
Default How to get the current path

Hi NickHK

Thanks a lot for your replies and your time. I appreciate it very
much, but I think we are still not talking about the same.

In real Visual Basic (I'm using VB6) I add a FileListBox (e.g.
FileListBox1) to the Form I'd like to know the current path (directory
where the EXE file has been started or the path which is entered in
'Start in:' if a shortcut of the EXE file has been started).

Normally I hide the FileListBox with
FileListBox1.Visible = False
FileListBox1.ZOrder 1

In the Form_Load I read the current path:
Private Sub Form_Load()
...
CurrentPath = FileListBox1.Path
...
End Sub

Now CurrentPath represents either the directory where the EXE file has
been started or the path which is entered in 'Start in:' if a shortcut
of the EXE file has been started.
That's the way I do it in real VB and that works perfect.

Because VBA (e.g. Excel) doesn't now the FileListBox control I'm
trying to get the same information somehow else.

To get the directory where the XLS file has been started I can do in
VBA with
ActiveWorkbook.Path

But I don't know how to get in VBA the path which is entered in 'Start
in:' of the shortcut of the started shortcut of the XLS file.