I have managed, with help to solve all of my problems, caused when I converted VBA programmes to VB6 programmes, with the exception of the following:
The programme that reads from MS Word documents, copies one of the documents, which includes a table, opens an Outlook Template file, and pastes the copied material into an e-mail body.
Below is a portion of the code, but this code does not copy the table, just text. If I comment out ‘OutlookFile.Body = WordObj.Selection, and then hit paste in Outlook, it correctly pastes the text and table.
Below is the relevant section of code at present.
I have tried all of the following, without any success:
Surely it must be simple, if all I have to do is hit paste, or Control-V, in Outlook?
Any help would be greatly appreciated.
john
The programme that reads from MS Word documents, copies one of the documents, which includes a table, opens an Outlook Template file, and pastes the copied material into an e-mail body.
Below is a portion of the code, but this code does not copy the table, just text. If I comment out ‘OutlookFile.Body = WordObj.Selection, and then hit paste in Outlook, it correctly pastes the text and table.
Below is the relevant section of code at present.
Code:
Public WordObj As Word.Application
Public WordFile As Object
Public OutlookObj As Outlook.Application
Public OutlookFile As Outlook.MailItem
-
-
-
WordObj.Selection.HomeKey Unit:=wdStory
WordObj.Selection.MoveDown Unit:=wdLine, Count:=32, Extend:=wdExtend
WordObj.Selection.Copy
Set OutlookObj = CreateObject("Outlook.Application")
Set OutlookFile = OutlookObj.CreateItemFromTemplate("C:\Documents and Settings\hbcw059\Application Data\Microsoft\Templates\ICOO Bidder Approval.oft")
OutlookFile.Display
OutlookFile.Body = WordObj.Selection ‘inserts text only
I have tried all of the following, without any success:
Code:
'SendKeys ("^V")
'OutlookFile.Body = Clipboard.GetData
'OutlookFile.Body = Clipboard.GetData(vbDataObject)
'OutlookFile.Body = Clipboard.GetText(vbDataObject)
'WordObj.Selection.PasteAndFormat (wdPasteDefault)
'OutlookObj.PasteAndFormat (wdPasteDefault)
'OutlookFile.PasteAndFormat (wdPasteDefault)
Surely it must be simple, if all I have to do is hit paste, or Control-V, in Outlook?
Any help would be greatly appreciated.
john