Name of current OpenDirectory

  • Thread starter Thread starter Steven M (remove wax to reply)
  • Start date Start date
S

Steven M (remove wax to reply)

Is there any way in VBA (Office 2000) to learn the name of the current
directory/folder?

I know how to change the current directory using the command
ChangeFileOpenDirectory

And I know how to see the current default folder, by examining

temp = Options.DefaultFilePath(wdDocumentsPath)

But neither one does what I want.

Say that my default folder is "C:\My Documents", but I have changed
the current directory from the default by "manually" opening a file in
a directory other than the default.

Can a macro obtain and do something with the name of this new folder?
 
Hi Steven

CurDir() will return the current drive and path. Word's VBA help
explains how it works.

Before you rely on temp = Options.DefaultFilePath(wdDocumentsPath), you
might like to read the following:
http://www.mvps.org/word/FAQs/MacrosVBA/GetDocPath.htm

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Melbourne, Australia


Steven M (remove wax to reply) said:
Is there any way in VBA (Office 2000) to learn the name of the current
directory/folder?

I know how to change the current directory using the command
ChangeFileOpenDirectory

And I know how to see the current default folder, by examining

temp = Options.DefaultFilePath(wdDocumentsPath)

But neither one does what I want.

Say that my default folder is "C:\My Documents", but I have changed
the current directory from the default by "manually" opening a file in
a directory other than the default.

Can a macro obtain and do something with the name of this new folder?



--
Steve M - (e-mail address removed) (remove wax for reply)

Chaos. I can relate to that. My life is chaos most of the time. I
am in tune with the universe. It feels like home. -- Robert
Fulghum
 
Actually, that's just what I needed. I want the last folder that the
user (me!) has used to open or save a file, NOT the folder that is
stored in Word / Tools / Options / File Locations.

Steven
 
Hi Steve

I don't like relying on old, known bugs or flaws in Word. If they ever
got fixed, the shock of finding out would be too great to bear<g>.

You might be better off with
Documents(1).Path
or
Documents("name of my most recently opened document.doc").Path

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Melbourne, Australia


Steven M (remove wax to reply) said:
Actually, that's just what I needed. I want the last folder that the
user (me!) has used to open or save a file, NOT the folder that is
stored in Word / Tools / Options / File Locations.

Steven




folder?


--
Steve M - (e-mail address removed) (remove wax for reply)

Chaos. I can relate to that. My life is chaos most of the time. I
am in tune with the universe. It feels like home. -- Robert
Fulghum
 
Back
Top