so ya, i did have option base 1 for my test code, but i removed that and the test procedure works great. but when i implement it in my actual code,it fails on: z(w,y)=t(w)
here is the real code.
Sub showuserform1()
Dim t() As String
Dim x, y
Dim z() As String
Set btn_nm = New Scripting.Dictionary
Set lbl_tx = New Scripting.Dictionary
Set code = New Scripting.Dictionary
repeatx:
x = UCase(InputBox("(H)orizontal or (V)ertical?", "Orientation", "H"))
If x = "H" Then
orientation = "Horizontal"
ElseIf x = "V" Then
orientation = "Vertical"
Else
MsgBox ("Input either 'H' or 'V'")
GoTo repeatx
End If
repeatcount:
count = InputBox("How many buttons do you want? ", "Button Count", "1")
If count < 1 Then
MsgBox ("Input Quantity of Buttons, enter at least 1")
GoTo repeatcount:
End If
For y = 1 To count
btn_nm(y) = InputBox("What do you want CommandButton" & y + 1 & " to say?", "CommandButton name", "CommandButton" & y)
lbl_tx(y) = InputBox("What do you want Label" & y + 1 & " to say?", "Label text", "Label" & y)
btn_Gen_uf2.Label1.Caption = "Enter Code in Window - max 8k characters"
btn_Gen_uf2.TextBox1.Value = ""
reshow:
btn_Gen_uf2.TextBox1.SetFocus
btn_Gen_uf2.Show
If btn_Gen_uf2.TextBox1.Value = "" Then
MsgBox "Enter Code in Window before selecting OK"
GoTo reshow:
End If
t = Split(btn_Gen_uf2.TextBox1.Text, vbCrLf)
ReDim z(LBound(t), count)
For w = LBound(t) To UBound(t)
MsgBox t(w)
Debug.Print "z(" & w & "," & y & ") = " & t(w)
z(w, y) = t(w)
Next w
Exit Sub
For s = 1 To count
For r = 0 To UBound(t)
Debug.Print z(r, s)
Next r
Next s
Next
so what should happen is that when the code window opens up (btn_Gen_uf2.show), it parses the text in the textbox and should populate each line into z(w,y). but when i check the local window this time, it shows z(0,0),z(0,1) & z(0,2) and only z(0,1) shows one of the text lines, but the other two are "". i know that sometimes single letters can be confusing so i will try to implement that in the future.
nevermind, your redim code worked for me. sorry that i glossed over it. thanks
Bookmarks