PDA

View Full Version : [SOLVED:] Adding a Scroll Option to The Text Boc Functionality



Forex-Forex
08-04-2017, 12:21 PM
Hi Excel Community

I have attached a questionnaire template and would like to modify the VBA slightly to show the following:

At the moment if you click on the create questionnaire button, an Excel template is created on your desktop.

However, when you choose the text box option, I can easily modify the length and width.

What I would like is on the text box option is to have a scroll bar because at the moment when you start typing and after it reaches the text box length you start losing visibility.

I would like if I choose a particular text box size, once it reaches the particular length, it then goes onto the second line.

I hope I am clear.

Is this possible community?

Appreciate any assistance.

Thanks

Leith Ross
08-04-2017, 06:24 PM
Hello Forex-Forex,

I made a change to the Select Case statement in the intLoop of the Sub evtCreateQuestionnaire. This adds several properties to the text box so it will function the way you want.



Select Case wksControl.Cells(intLoop, intColType).Value
Case "Ques"
Set ole = wksQuestionnaire.OLEObjects.Add("Forms.Label.1")
intQues = intQues + 1
Application.StatusBar = "Ques " & intQues & "..."
Case "Radio"
Set ole = wksQuestionnaire.OLEObjects.Add("Forms.OptionButton.1")
ole.Object.GroupName = "QGrp" & CStr(intQues)
Case "Check"
Set ole = wksQuestionnaire.OLEObjects.Add("Forms.CheckBox.1")
ole.Object.GroupName = "QGrp" & CStr(intQues)
Case "Text"
Set ole = wksQuestionnaire.OLEObjects.Add("Forms.TextBox.1")
With ole.Object
.EnterKeyBehavior = True
.MultiLine = True
.ScrollBars = fmScrollBarsVertical
.WordWrap = True
End With
Case "Spin"
Set ole = wksQuestionnaire.OLEObjects.Add("Forms.SpinButton.1")
End Select

Forex-Forex
08-04-2017, 06:38 PM
Many thanks Leith for your suggestion.

Most grateful