I have a number of problems with my programmes in VB6, but it appears that they are due to the clipboard.
The simplest one is where my programme, randomly stops and advises that it cannot copy or paste to the clipboard.
I entered VB.Clipboard.Clear throughout my programme. However, I checked the clipboard after my programme ran, and found 24 items still on the clipboard!
In another programme, that reads from MS Word documents (originally this was written in VBA Word), 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.
I only need to know how to tell my programme to Ctrl V, or equivalent. I have tried SendKey(“^V”), without success.
Below is the relevant 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, not the table
any ideas on what could be causing this?
Regards,
john