LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying results to clipboard. Is there a better way ?

Inside a userform there is some code that takes a string, does some
calculation, and produces a result. This result needs to be "sent" to the
clipboard, so that the user - if needing it - can paste it in a cell. For
example, the user enters the 12 first digits of a barcode string, the code
calculates the check digit and then concatenates both in order to create the
entire barcode string.
This string is sent to the clipboard, so that the user can paste it in a cell.

In order to do this, i have declared a variable twice, once as a string and
once again as a New Dataobject:

Dim CodeToEvaluate, CompleteCode As String
Dim CC As Integer
Dim CompleteCodeFinal As New DataObject

After the user enters CodeToEvaluate, some calculation is done for CC to be
found, and then

Let CompleteCode = CodeToEvaluate & CC

Complete code is shown to the user with an Msgbox, and then

CompleteCodeFinal.SetText CompleteCode
CompleteCodeFinal.PutInClipboard

It Works OK. BUT i wonder if there is a more "elegant" way to do this.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? tskogstrom Excel Programming 2 March 6th 07 12:50 PM
Insert columns copied to clipboard results in vaues not forumlas mendozalaura Excel Programming 5 October 19th 06 05:37 PM
Copying more than 255 Characters to the Clipboard biker Excel Programming 1 July 12th 06 02:05 PM
Copying to Clipboard query. Rodney New Users to Excel 4 May 2nd 05 09:42 PM
Copying a range to clipboard Richard[_18_] Excel Programming 10 October 7th 03 04:10 AM


All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"