VB to set wordwrap on Control Toolbox Textbox

P

PCLIVE

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

--
 
L

Leith Ross

Hello Paul,

Here is a macro to change "TextBox1" on the active sheet to wrap th
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 Ros

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/
 
M

Mike H

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top