我正试图用Excel打开Outlook 2010电子邮件模板,但出现以下错误:
"运行时错误“-2147287038(80030002)”:
无法打开文件:
C:\ My \ Path \ MyTemplate.oft。 文件可能不存在,您可能没有权限打开它,或者它可能在另一个程序中打开。右键单击包含文件的文件夹,然后单击属性以检查您对该文件夹的权限。"
文件存在(位于正确位置),我已检查权限(尽我所知的方法),且文件未被打开。
Sub Mail_experiment()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.mailitem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItemFromTemplate("C:\My\Path\MyTemplate.oft")
On Error Resume Next
With OutMail
.to = "myEmail@aol.com"
.CC = ""
.BCC = ""
.Subject = "This is my Subject line"
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub