自Outlook的最新安全更新以来,我的代码无法运行。使用Outlook 2010.后面有自定义代码的联系表单。我单击自定义按钮以在“历史记录”文件夹中打开帖子项目。帖子项后面有自定义代码,用于将信息写入文本文件。这对于此运行非常重要。几天前,帖子项目上的代码不再运行了。但是,如果我保存帖子项目,关闭它并重新打开它,代码运行正常。发生了什么,我该如何解决?
'this is the code on the contact form
Sub CallFromButton
'get the folder
Dim HistFolder
Set HistFolder = Application.Session.GetDefaultFolder(18).Folders("History")
'add a post item
Dim blgItem 'PostItem
Set blgItem = HistFolder.Items.Add("IPM.Post.ClientHistory2")
'set some information
blgItem.BillingInformation = "60000"
blgItem.UserProperties("ClientName") = item.FullName
blgItem.UserProperties("blgDate") = Now
blgItem.Display
'... more code
End Sub
'this is the code behind the post item
Sub Item_Open()
Dim LogPage
Set LogPage = Item.GetInspector.ModifiedFormPages("Log Item")
LogPage.Controls("ResumeBtn").Visible = False
LogPage.Controls("BoxDesc").SetFocus
Item.UserProperties("blgFileName") = "C:\Temp\12345.txt"
'... more code
End Sub
Function Item_Write()
'... more code
End Function
答案 0 :(得分:1)
最新的Windows更新导致了这种情况。您可以将其卸载,也可以等待Microsoft的修复:https://social.technet.microsoft.com/Forums/office/en-US/e6147cb8-fe1c-4d90-a65a-33b8a7b22a6d/june-security-patch-and-issue-with-custom-forms?forum=outlook