从第4行开始选择Word VBA

时间:2015-09-09 11:48:02

标签: vba ms-word outlook

我使用以下代码从Microsoft Word复制文本和图像并粘贴到Outlook电子邮件的正文中。我试图排除前4行被复制(此代码复制文档中的所有内容)。我怎么能这样做呢?

Sub CopycontentintoOutlook()

Dim oMailItem As Object
Dim oWordApp As Object
Dim oWordDoc As Object
Dim oMailWordDoc As Object

Set oWordApp = CreateObject("Word.Application")
Set oWordDoc = ActiveDocument

oWordDoc.Content.Copy

Set oMailApp = CreateObject("Outlook.Application")
Set oMailItem = oMailApp.CreateItem(0)

With oMailItem
.To = "email"
.Subject = "This email contains Word-formatted text"
.Display
End With

Set oMailWordDoc = oMailApp.ActiveInspector.WordEditor

oMailWordDoc.Application.Selection.Paste

End Sub

我也想知道是否可以使用第一行中的文字并将其设置为电子邮件主题?

0 个答案:

没有答案