run-time error 424

J

Juse Lius

Hello! I wonder why I'm getting an error line:
kopioiValitutListasta_oikeaan getTextBox
----
Private Sub ComboBox1_Change()
kopioiValitutListasta_oikeaan getTextBox
End Sub

Sub kopioiValitutListasta_oikeaan(kohde As textbox)
UserForm1.list2Lbox.Clear
stmp = kohde.Text
iPos1 = 1
iPos2 = InStr(stmp, vbCrLf)
Do While iPos2
UserForm1.list2Lbox.AddItem Mid$(stmp, iPos1, iPos2 - iPos1)
iPos1 = iPos2 + 2
iPos2 = InStr(iPos1, stmp, vbCrLf)
Loop
End Sub

Function getTextBox()

Dim valittu As String
Dim etiketti As textbox
valittu = UserForm1.ComboBox1.Value

Select Case valittu
Case "1"
Set etiketti = ThisDocument.TextBox1
Case "2"
Set etiketti = ThisDocument.TextBox2
Case "3"
Set etiketti = ThisDocument.TextBox3
Case "4"
Set etiketti = ThisDocument.TextBox4
Case "5"
Set etiketti = ThisDocument.TextBox5
Case "6"
Set etiketti = ThisDocument.TextBox6
Case "7"
Set etiketti = ThisDocument.TextBox7
Case "8"
Set etiketti = ThisDocument.TextBox7
End Select
getTextBox = etiketti
End Function

Any suggestions?
 

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