在显示对话框之前,在另存为中从拾取的文件夹中获取路径 [英] Get the path from the picked folder in Save As before showing dialog
问题描述
您好
如果我在后台菜单office 2013中的Word文件另存为中选择一个文件夹,我想在显示该对话框之前知道该文件夹的路径。我尝试过使用documentbeforesave但找不到任何东西。
Ola
Ola
您好,
DocumentBeforeSave事件将在对话框显示之前发生,所以我尝试使用以下代码获取对话框的文件名,第一个返回与Options相同的默认文档路径 - >保存 - >默认本地文件位置。
第二个返回没有路径的文件名,如Doc1.docx
Application.FileDialog(msoFileDialogSaveAs).InitialFileName
对话框(wdDialogFileSaveAs).Name
我还添加了一个断点来观察这两个对象,遗憾的是,没有成员可以返回选定的文件夹路径。 / p>
由于Office在Dialog或FileDialog对象显示时没有提供任何事件,我认为我们无法在对话框中获取所选文件夹路径。
问候,
Celeste
Hi
If I pick a folder in Word File Save As in backstage menu office 2013 I want to know the path of that folder before I show the dialog. I have tried with documentbeforesave but could not find any thing.
Ola
Ola
Hello,
The DocumentBeforeSave event would occur before the dialog shows, so I try to get file name of the dialog using the following code, the first returns default document path same as Options -> Save -> Default local file location.
The 2nd returns the filename without path like Doc1.docx
Application.FileDialog(msoFileDialogSaveAs).InitialFileName
Dialogs(wdDialogFileSaveAs).Name
I also add a break point to watch the two objects, unfortunately, there is no member to return the selected folder path.
Since Office doesn't provide any event when Dialog or FileDialog object shows, I think we could not get the selected folder path in the dialog.
Regards,
Celeste
这篇关于在显示对话框之前,在另存为中从拾取的文件夹中获取路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!