Vba SharePoint URL不工作的CreateItemFromTemplate
我试图使用VBA操作SharePoint网站上的电子邮件模板,但是,每当我使用该模板生成电子邮件时,我都会收到以下错误: “错误5:过程调用或参数无效” 这些模板被许多人使用并且经常更改,因此我的用户将无法在本地存储它们 请在下面查找我的当前代码:Vba SharePoint URL不工作的CreateItemFromTemplate,vba,excel,Vba,Excel,我试图使用VBA操作SharePoint网站上的电子邮件模板,但是,每当我使用该模板生成电子邮件时,我都会收到以下错误: “错误5:过程调用或参数无效” 这些模板被许多人使用并且经常更改,因此我的用户将无法在本地存储它们 请在下面查找我的当前代码: Function Gen_Email(filename As String) Dim olApp As Object Dim olMail As Object Const olFormatHTML As Long = 12345 Const olIm
Function Gen_Email(filename As String)
Dim olApp As Object
Dim olMail As Object
Const olFormatHTML As Long = 12345
Const olImportanceHigh As Long = 4
Set olApp = CreateObject("Outlook.Application")
'v----This causes the issue; "filename" points to a SharePoint site
Set olMail = olApp.CreateItemFromTemplate(filename)
bodyText = olMail.HTMLBody
subjectText = olMail.Subject
Set olMail = Nothing
Set olApp = Nothing
'<More code here>
End Function
函数genu\u电子邮件(文件名为字符串)
作为对象的Dim-olApp
将邮件作为对象
常量olFormatHTML,长度=12345
常量重要性高,长度=4
设置olApp=CreateObject(“Outlook.Application”)
"v",这就产生了问题,;“文件名”指向SharePoint网站
设置olMail=olApp.CreateItemFromTemplate(文件名)
bodyText=olMail.HTMLBody
subjectText=olMail.Subject
设置olMail=Nothing
设置olApp=Nothing
'
端函数
函数“CreateItemFromTemplate”只适用于本地文件,这就是发生上述问题的原因
上述问题的解决方案只需要两个更改:
*.oft
type的文件名是吗?@vityta我想是的,但再看一眼,它们都是*.msg。如果将模板放在本地,它能工作吗?@vityta模板在本地存储时能工作。