简体   繁体   中英

Microsoft Word Document Current Path

I have created an Excel to Word mailmerge and the Word document is my Merge Template.

When i use the current path codes, eg CurDir(), ActiveDocument.Path,ThisDocument.FullName etc. etc. it gives me:

C:\\users\\rgillooly\\AppData\\Roaming\\Microsoft\\Templates Which is where the Normal.dotm file sits.

Is there any code that will pick up the "Files" actual location and not where its pointing to ? Eg C:\\users\\rgillooly\\desktop\\MailMerge

Cheers

I saved my document master.docm (Word Document with Macros): It gives the directory of the good current document:

CurDir() => C:\users\rgillooly\desktop\MailMerge
ActiveDocument.Path => C:\users\rgillooly\desktop\MailMerge
ThisDocument.FullName => C:\users\rgillooly\desktop\MailMerge\master.docm

If saved as master.dotm (Word Template), it gives config directory:

CurDir() => C:\users\rgillooly\AppData\Roaming\Microsoft\Templates
ActiveDocument.Path =>
ThisDocument.FullName => C:\users\rgillooly\AppData\Roaming\Microsoft\Templates\master.dotm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM