0
我試過這個Microsoft Word宏,將我已經完成的選擇粘貼到新電子郵件中,但是當我以HTML格式執行時,雖然在末尾沒有<br>
每一段,結果都是一句一句的,沒有回車。從Microsoft Word到Outlook的選擇使用VBA的新電子郵件
例子:
文本1
文本2
文本3
我得到:
文本1文本2文本3
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = ActiveDocument.Range(Start:=Selection.Start, End:=Selection.End)
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
On Error Resume Next
With OutMail
.Display
.To = "[email protected]"
.CC = "[email protected]"
.BCC = ""
.Subject = Date
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><body><font face=""calibri"" style=""font-size:11pt;""><br>" & rng & _
"<br><br></body>" & _
"Best Reagrds" & _
.HTMLBody & "</font>"
.Text
的一種方式解決這個問題可能會使用文本框。請參閱https://stackoverflow.com/questions/45362791/vba-email-loop-for-excel-reporting/45363726#45363726 –
在Word中這不起作用!它出現了編譯錯誤:Sub或Function沒有在Set上定義r =範圍(「B1) – massimob1972
右邊 - 那個代碼是爲Excel模塊編寫的 –