[我正在尝试使用Excel VBA中的数据编写带有Outlook VBA的电子邮件。
我想将excel中的表格粘贴到邮件中,然后编辑一些单元格并将某些单元格设置为表格内的项目符号列表。
我设法将表格从excel复制到Outlook WordEditor。
现在,我需要访问表格的单元格并编辑单元格的文本+格式化单元格的文本,例如作为项目符号列表。
我可以访问单元格并使用以下命令更改文本
Dim currentCell As Variant
currentCell = wdDoc.Tables(1).Cell(2, 2)
currentCell.Text = "Text"
[我还设法用currentCell.ListFormat.ApplyBulletDefault
在单元格内创建了项目符号列表,但我想要一个-而不是标准项目符号。
我现在如何将Cell(2,2)中的文本格式化为项目符号列表?
Picture: This is the structure I am looking for
非常感谢您的帮助!
此VBA功能创建邮件并在邮件正文中添加项目符号列表。现在,您只需要用单元格中的数据替换text
变量
Sub send()
Dim objOutlook As Object
Dim objMail As Object
Dim text As String
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
text = "This is a summary" & Chr(10) & _
Chr(149) & " First point" & Chr(10) & _
Chr(149) & " Second point" & Chr(10) & _
Chr(149) & " Last point"
With objMail
.To = "[email protected]"
.Subject = "Subject"
.Body = text
.Display
End With
End Sub
[如果您要将项目符号列表添加到一个单元格中,则可以使用相同的方法,例如下面的代码将列表添加到当前活动单元格中:
Sub Bullets()
Text = "This is a summary" & Chr(10) & _
Chr(149) & " First point" & Chr(10) & _
Chr(149) & " Second point" & Chr(10) & _
Chr(149) & " Last point"
ActiveCell.Value = Text
End Sub