ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB to set wordwrap on Control Toolbox Textbox (https://www.excelbanter.com/excel-programming/422588-vbulletin-set-wordwrap-control-toolbox-textbox.html)

PCLIVE

VB to set wordwrap on Control Toolbox Textbox
 
I have a textbox (created from the Control Toolbox). Using VBA, how can I
set the WordWrap and Multiline properties?
I have tried the following code. It sets the first two properties, but it
errors on the "WordWrap" property. Individually, I've also tested the
Multiline property with the same result. What am I doing wrong?

ActiveSheet.OLEObjects("Quest1Date").Select
With Selection
.Enabled = False
.LinkedCell = "AA1"
.WordWrap = True
End With



Thanks,
Paul

--




Leith Ross[_729_]

VB to set wordwrap on Control Toolbox Textbox
 

Hello Paul,

Here is a macro to change "TextBox1" on the active sheet to wrap the
text.

=================================
Sub Macro1()

Dim TB As Object

Set TB = ActiveSheet.OLEObjects("TextBox1").Object
With TB
.EnterKeyBehavior = True
.MultiLine = True
.WordWrap = True
End With

End Sub
=================================


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=51340


PCLIVE

VB to set wordwrap on Control Toolbox Textbox
 
That's it!

Thank you.
Paul

--

"Leith Ross" wrote in message
...

Hello Paul,

Here is a macro to change "TextBox1" on the active sheet to wrap the
text.

=================================
Sub Macro1()

Dim TB As Object

Set TB = ActiveSheet.OLEObjects("TextBox1").Object
With TB
EnterKeyBehavior = True
MultiLine = True
WordWrap = True
End With

End Sub
=================================


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=51340




Mike H

VB to set wordwrap on Control Toolbox Textbox
 
Try this

Sub Stupid_Syntax()
With ActiveSheet.OLEObjects("Quest1Date")
.Enabled = False
.LinkedCell = "AA1"
With .Object
.MultiLine = True
.WordWrap = True
End With
End With
End Sub

Mike

"PCLIVE" wrote:

I have a textbox (created from the Control Toolbox). Using VBA, how can I
set the WordWrap and Multiline properties?
I have tried the following code. It sets the first two properties, but it
errors on the "WordWrap" property. Individually, I've also tested the
Multiline property with the same result. What am I doing wrong?

ActiveSheet.OLEObjects("Quest1Date").Select
With Selection
.Enabled = False
.LinkedCell = "AA1"
.WordWrap = True
End With



Thanks,
Paul

--






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

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