Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Copy textbox contents

Cannot find how to do this, even via the macro recorder:

Copy the contents of a Drawing toolbox textbox to a
range in a new sheet, resulting in the range displaying the
contents exactly as did the textbox.

Is this possible, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Copy textbox contents

If there's lots of text in the textbox:

http://support.microsoft.com/default.aspx?id=148815
How to Copy Text to TextBoxes Using the Characters Method

If you don't need that KB article:

Option Explicit
Sub testme01()
Dim myTB As TextBox
With Worksheets("sheet1")
Set myTB = .TextBoxes("text box 1")
.Range("a1").Value = myTB.Text
End With
End Sub

(I'm not sure what exactly means. If you mean wrap in the same spot--caused by
automatic line breaks--not enter keys, then I think you'll have lots of
trouble.)

Good luck,


Stuart wrote:

Cannot find how to do this, even via the macro recorder:

Copy the contents of a Drawing toolbox textbox to a
range in a new sheet, resulting in the range displaying the
contents exactly as did the textbox.

Is this possible, please?

Regards.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Copy textbox contents

Many thanks.

I've actually 3 textboxes:
TextBox 11 positioned over the range "A12:A62"
TextBox 10 positioned over the range "B12:D62"
TextBox 12 positioned over the range "E12:E62"
and I'm copying the contents to a sheet in a new book.

This seems to work, and to preserve the layout of the
text in the original textbox:

Option Explicit
Sub testme02()
Dim TB1 As TextBox, TB2 As TextBox, TB3 As TextBox

With Workbooks("Book2").Worksheets("Sheet1")
.Range("A12:A62").MergeCells = True
.Range("A12:A62").WrapText = True
.Range("A12:A62").VerticalAlignment = xlTop
.Range("B12:D62").MergeCells = True
.Range("B12:D62").WrapText = True
.Range("B12:D62").VerticalAlignment = xlTop
.Range("E12:E62").MergeCells = True
.Range("E12:E62").WrapText = True
.Range("E12:E62").VerticalAlignment = xlTop
End With

With Workbooks("xxx-Contract Master RFI.xls") _
.Worksheets("Contract RFI")
Set TB1 = .TextBoxes("text box 11")
Workbooks("Book2").Worksheets("Sheet1") _
.Range("a12").Value = TB1.Text
Set TB2 = .TextBoxes("text box 10")
Workbooks("Book2").Worksheets("Sheet1") _
.Range("b12").Value = TB2.Text
Set TB3 = .TextBoxes("text box 12")
Workbooks("Book2").Worksheets("Sheet1") _
.Range("e12").Value = TB3.Text
End With
End Sub

Regards.



"Dave Peterson" wrote in message
...
If there's lots of text in the textbox:

http://support.microsoft.com/default.aspx?id=148815
How to Copy Text to TextBoxes Using the Characters Method

If you don't need that KB article:

Option Explicit
Sub testme01()
Dim myTB As TextBox
With Worksheets("sheet1")
Set myTB = .TextBoxes("text box 1")
.Range("a1").Value = myTB.Text
End With
End Sub

(I'm not sure what exactly means. If you mean wrap in the same

spot--caused by
automatic line breaks--not enter keys, then I think you'll have lots of
trouble.)

Good luck,


Stuart wrote:

Cannot find how to do this, even via the macro recorder:

Copy the contents of a Drawing toolbox textbox to a
range in a new sheet, resulting in the range displaying the
contents exactly as did the textbox.

Is this possible, please?

Regards.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004


--

Dave Peterson



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004


Reply
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
Export TextBox contents to new workbook. Andy Tallent Excel Discussion (Misc queries) 0 February 22nd 05 01:49 PM
Write Contents of TextBox to new Workbook Andy Tallent Excel Discussion (Misc queries) 0 February 21st 05 11:45 AM
Copy textbox contents to a range on a sheet Stuart[_5_] Excel Programming 0 August 10th 04 07:22 PM
CONTENTS OF TEXTBOX TO BE THE CRITERIA ON A DATABASE QUERY AQM Excel Programming 6 May 28th 04 02:18 PM
clear textbox contents dirt Excel Programming 1 January 27th 04 04:25 AM


All times are GMT +1. The time now is 10:52 AM.

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

About Us

"It's about Microsoft Excel"