编辑OFT用VBA代码
问题描述:
我想用VBA代码编辑OFT编辑OFT用VBA代码
Private Sub CommandButton1_Click()
template = "T:\Coordination des interventions\Coordination des changements\Communications\Interruption de service planifiée - Environnements applicatifs Oracle - Copie.oft"
strNew = InputBox("Jour de la semaine")
strFind = "%>JourSemaine<%"
Dim oApp As Object, oMail As Object
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItemFromTemplate(template)
With oMail
'strFind = "Code:"
'strNew = "Code:" & Cells(4, 3) ' for example
.HTMLBody = Replace(oMail.HTMLBody, strFind, strNew)
.Display
End With
End Sub
这是我得到一个错误287(我SYSTEME是法语)
.HTMLBody = Replace(oMail.HTMLBody, strFind, strNew)
人有线索?
答
确保您设置了格式良好的HTML标记。例如:
With oMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Enter the message text here. </BODY></HTML>"
.Display
End With
调用Replace方法,您也可以替换一些HTML标记。