Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

current drive and directory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffery B Paarsa - 05 Oct 2006 05:38 GMT
Hello,

In a VBA, is there any way that I can find out the current drive and
directory that I am currently using?  I have a few templates that all are
stored in a single directory.  I would like to make the VBA codes inside of
these Word Templates independent of drive letter and directory name that they
are stored.  Inside of these codes I would like to be able to find out what
drive and directory I am currently executing the code so based on that I
could open the next template.  Any idea?  
Signature

Jeff B Paarsa

Jonathan West - 05 Oct 2006 07:57 GMT
> Hello,
>
[quoted text clipped - 8 lines]
> drive and directory I am currently executing the code so based on that I
> could open the next template.  Any idea?

Application.MacroContainer.FullName gives you the full pathname of the
template containing the code being run

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

Jeffery B Paarsa - 05 Oct 2006 16:46 GMT
Thanks,  I will give this one a shut too but right after I posted this
question I stumble to "FileSystem.CurDir" and I was able to get to the string
of the current drive and directory.  But FileSystem.CurDir does not work whey
you use it in the Insert Field INCLUDETEXT on the Header and Footer section.
Signature

Jeff B Paarsa

> > Hello,
> >
[quoted text clipped - 11 lines]
> Application.MacroContainer.FullName gives you the full pathname of the
> template containing the code being run
Jean-Yves - 06 Oct 2006 15:41 GMT
Hi Jeffery,

use CurDir. Paste in VBA , press the F1 key and you will get all info.
Regards
JY

> Thanks,  I will give this one a shut too but right after I posted this
> question I stumble to "FileSystem.CurDir" and I was able to get to the
[quoted text clipped - 23 lines]
>> Application.MacroContainer.FullName gives you the full pathname of the
>> template containing the code being run
Cindy M. - 09 Oct 2006 10:11 GMT
Hi =?Utf-8?B?SmVmZmVyeSBCIFBhYXJzYQ==?=,

> I will give this one a shut too but right after I posted this
> question I stumble to "FileSystem.CurDir" and I was able to get to the string
> of the current drive and directory.  But FileSystem.CurDir does not work whey
> you use it in the Insert Field INCLUDETEXT on the Header and Footer section.

You have to be careful with CurDir. CurDir might not be the same folder as the
current document, or the template containing the macro.

Jonathan gave you the way to get the path for the template containing the macro.

Nothing in your original message even hints at your wanting to use IncludeText
in the header/footer section. You certainly CANNOT use VBA *in* field codes;
field codes do not support VBA. If the content you're linking into a document
isn't in the same file, or file path, of the current document, then you have to
use the complete file path. The CurDir is irrelevant, because it will always be
the folder which the Word APPLICATION last accessed.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.