格式化约会正文 [英] Formatting appointment body
问题描述
我正在尝试从 Excel 自动安排会议.
这很简单,除非您尝试格式化正文.
我对 GetInspector 进行了一些研究.
看起来我必须从另一个地方复制文本,但我发现的命令不正确或不起作用.甚至试图将其格式化为 RTF,但 .RTFBody 不是 AppointmentItem 对象的属性
I am trying to schedule a meeting automatically from Excel.
It is simple, unless you are trying to format the body text.
I made some research about GetInspector.
It looks like I have to copy the text from another place, but the commands I found are incorrect or not functional. Even trying to format it as RTF, but .RTFBody is not a property of the AppointmentItem object
查找我的代码:
Dim oApp As Object
Dim oMail As Object
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(1)
With oMail
.Subject = ""
.Location = ""
'.Start =
'.Duration =
.body = " < not formattable text >"
.display
End With
Set oApp = Nothing
Set oMail = Nothing
推荐答案
我曾经问过这个问题,在这里得到了答案(http://www.slipstick.com/developer/code-samples/paste-formatted-text-vba/)
I once asked this question, and got an answer here (http://www.slipstick.com/developer/code-samples/paste-formatted-text-vba/)
尝试以下操作.您需要设置对 Word 对象模型的引用,格式化文本应存储在剪贴板中,注意,您必须在 .body<之前有
.display
行/code> 行,以便可以使用:
Try the following. You will need to set a reference to the Word Object Model, and the formatted text should be stored in the clipboard, and note, you have to have the .display
line before the .body
line for there to be something to work with:
Dim oApp As Object
Dim oMail As Object
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(1)
With oMail
.Subject = ""
.Location = ""
'.Start =
'.Duration =
' .body = " < not formattable text >"
.display
End With
Dim objItem As Object
Dim objInsp As Outlook.Inspector
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
Set objItem = oMail ' Application.ActiveInspector.currentItem
Set objInsp = objItem.GetInspector
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
objSel.PasteAndFormat (wdFormatOriginalFormatting)
'objSel.PasteAndFormat (Word.WdRecoveryType.wdFormatOriginalFormatting)
Set objItem = Nothing
Set objInsp = Nothing
Set objDoc = Nothing
Set objWord = Nothing
Set objSel = Nothing
Set oApp = Nothing
Set oMail = Nothing
第
这篇关于格式化约会正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!