ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Put Info from Clipboard to Textbox on form (https://www.excelbanter.com/excel-programming/304605-re-put-info-clipboard-textbox-form.html)

keepITcool

Put Info from Clipboard to Textbox on form
 

textbox must have multiline=true
and following uses a JOIN to concatenate the cell contants...
so you'll need xl2k or newer.


LOAD frm3

'in the calling macro BUT preferably in the form's initialize event)
frm3.txtPartsPrediction.Value = _
Join( Range(Cells(1,1), Cells(Rows.Count, 1).End(xlUp).Offset(0,
4)),vblf)

frm3.show

if the form is modal any code after the SHOW will only be executed
AFTER the form is closed.


but my real tip: buy a book and do some studying.
Excel you can (sort of) learn by trial and error,
VBA needs understanding of fundamentals.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Stan wrote :

Hi All,

I'm trying to transfer some information (that was on a sheet) to a
textbox on a form. I am however having a lot of trouble with this.

I have tried a few things including the send keys approach, and
GetFromClipboard. The code below is what I've got so far, however
and although it doesn't crash, no text appears in the textbox. (If
however I click in the textbox and click 'Ctrl+V' it works - for some
reason?!?!?)

Any suggestions?
All help is greatly appreciated!



Workbooks("Testing Ground.XLS").Sheets("Paste").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
ActiveSheet.Paste

Range("B10:B11,B18").Select
Selection.Delete Shift:=xlToLeft

Range("A1").Activate
Set d = Range(ActiveCell, Cells(Rows.Count, 1).End(xlUp).Offset(0, 4))

d.Select
Selection.Copy

frm3.Show


Dim objData As New DataObject
objData.GetFromClipboard
frm3.txtPartsPrediction.Value = objData.GetText


Thanks
Stan




All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com