Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,447 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,169 people online right now. Registration is fast and FREE... Join Now!




Problems Controlling Clipboard

 
Reply to this topicStart new topic

Problems Controlling Clipboard

johnmtb
27 Jul, 2008 - 11:58 PM
Post #1

New D.I.C Head
*

Joined: 27 Jul, 2008
Posts: 2

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

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 02:48PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month