我以前使用下面的代码在Outlook的草稿文件夹中移动工作表。这曾经有效-但现在不再起作用(似乎绝对是随机的?),并给我类似下面的错误。
跑带错误'429'; active X组件无法创建对象
它落在下面:
Set olApp = CreateObject("Outlook.Application")
我已激活参考:microsofct Outlook对象14.0。我使用Outlook 2010 / Excel 2010。
sub REPORT
Dim olApp As Outlook.Application,thisMail As Outlook.MailItem
Dim StrSharePointURL As String
Set olApp = CreateObject("Outlook.Application")
Set thisMail = olApp.CreateItem(olMailItem)
Dim printArea_rowCount As Integer
printArea_rowCount = Cells(3000,"c").End(xlUp).Row - 1
Dim RangeSpecifier As String
RangeSpecifier = "E3:L61"
EmailSub = "report" & " for xxyy "
With thisMail
.BodyFormat = olFormatHTML
.Subject = EmailSub
.HTMLBody = strBody_Consol & "<br/>" & RangetoHTML(Sheet19.Range(RangeSpecifier))
.To = Range("P4")
.CC = Range("P6")
.Save
'.Display
End With
Set olApp = Nothing
Set thisMail = Nothing
MsgBox "look in your drafts"
end sub