【发布时间】:2016-02-23 08:54:12
【问题描述】:
我正在尝试使用 Application.PathSeparator 属性。但是 PathSeparator 属性不可用于选择,如果我在我的 VBA 代码中输入它,我会收到运行时错误 438 - 对象不支持此属性或方法。
我需要安装什么东西才能访问 PathSeparator 吗?我有 MS Office 2007 和 Outlook 2010。我没有安装 .Net 客户端。
尝试在下面的示例代码中使用:
Sub UnZipFile(strTargetPath As String, Fname As String)
Dim oApp As Object
Dim FileNameFolder As Variant
If Right(strTargetPath, 1) <> Application.PathSeparator Then
strTargetPath = strTargetPath & Application.PathSeparator
End If
FileNameFolder = strTargetPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(strTargetPath & Fname).items
DoEvents
End Sub
【问题讨论】:
-
是什么让您认为该属性应该存在? IE。你以前见过的地方。显示一些参考资料。
-
对此感到抱歉。我正在尝试循环浏览特定 Outlook 文件夹中的电子邮件,以将附件保存到 Windows 文件夹。一些附件是 zip 文件中的 Excel 文件,而其他附件只是 Excel。所以我有示例代码来解压缩它使用这个属性。请参阅上面的原始问题代码:
-
请不要在 cmets 中粘贴代码。
-
好的,我看到你的代码了。是什么让您认为应该存在名为
Application.PathSeparator的东西?你从哪里得到这个概念? -
@roryap here
标签: vba outlook path-separator