hi guys
I want to find out how to copy data (with format) from a word doc and automatically paste it onto an outlook email.
I have this code which worked for word 2010 but the problem is it does not work for 2003. Does anyone happen to have any solution for this?
This part of the code gives an error on word 2003 I tried changing references but nothing is working. If anyone has another way please tell me thanks
Set OutInsp = OutMail.GetInspector
Set OutDoc = OutInsp.WordEditor
Set WdApp = OutDoc.Application
Set WdSel = WdApp.Selection
I want to find out how to copy data (with format) from a word doc and automatically paste it onto an outlook email.
I have this code which worked for word 2010 but the problem is it does not work for 2003. Does anyone happen to have any solution for this?
Code:
Private Sub CommandButton1_Click()CommandButton1.BackColor = 16777215
CommandButton1.ForeColor = 16777215
Dim OutApp As Object
Dim OutMail As Object
'Dim OutInsp As Outlook.Inspector
Dim WdApp As Word.Application
Dim OutDoc As Word.Document
Dim WdSel As Word.Selection
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ""
.Subject = ""
.Display
End With
Set OutInsp = OutMail.GetInspector
Set OutDoc = OutInsp.WordEditor
Set WdApp = OutDoc.Application
Set WdSel = WdApp.Selection
ActiveDocument.Range.Copy
WdSel.PasteAndFormat Type:=wdFormatOriginalFormatting
Set WdSel = Nothing
Set OutInsp = Nothing
Set OutMail = Nothing
Set OutDoc = Nothing
Set WdApp = Nothing
Set OutApp = Nothing
End Sub
This part of the code gives an error on word 2003 I tried changing references but nothing is working. If anyone has another way please tell me thanks
Set OutInsp = OutMail.GetInspector
Set OutDoc = OutInsp.WordEditor
Set WdApp = OutDoc.Application
Set WdSel = WdApp.Selection