找不到Outlook Application.FileDialog [英] Outlook Application.FileDialog not found
本文介绍了找不到Outlook Application.FileDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为Outlook编写VBA宏,并且Application.FileDialog方法不可用.
I'm writing a VBA macro for Outlook and the Application.FileDialog method is not available.
目的是让用户选择一个文件夹-不是Outlook电子邮件文件夹,而是文件系统目录文件夹.
The intent is for the user to select a folder - not an Outlook email folder, but a file system directory folder.
以下是我启用的参考:
- Visual Basic for Applications Microsoft Outlook 15.0对象库
- Microsoft Office 15.0对象库OLE自动化Microsoft窗体
- Microsoft Office 15.0对象库
- OLE Automation Microsoft表单对象库
- Microsoft脚本运行时
- Microsoft Office 15.0 Access数据库引擎对象库
有什么想法吗?
推荐答案
Outlook不支持FileDialog对象.解决方法:
Outlook doesn't support the FileDialog object. Here's a workaround:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Dim fd As Office.FileDialog
Set fd = xlApp.Application.FileDialog(msoFileDialogFilePicker)
Dim selectedItem As Variant
If fd.Show = -1 Then
For Each selectedItem In fd.SelectedItems
Debug.Print selectedItem
Next
End If
Set fd = Nothing
xlApp.Quit
Set xlApp = Nothing
这篇关于找不到Outlook Application.FileDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文