vba 获取当前Word文档的保存目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17031763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get current Word document's save directory
提问by ikathegreat
I have a Word document that is already saved and I need to get its existing save directory and/or full file path (i.e. C:\Users\Public\Documents\testDoc.docx).
我有一个已保存的 Word 文档,我需要获取其现有的保存目录和/或完整文件路径(即 C:\Users\Public\Documents\testDoc.docx)。
How can this be acquired from a macro/VBA?
如何从宏/VBA 获取它?
回答by shahkalpesh
ActiveDocument.FullName
The above gives the full path to the document, including the file name.
上面给出了文档的完整路径,包括文件名。
ActiveDocument.Path
The above gives the directory where your document is saved.
上面给出了保存文档的目录。
ActiveDocument.Name
The above gives the name of the document, without path information.
上面给出了文档的名称,没有路径信息。