Tell me, please, why: code1 works & code2 doesn't work
code1
code2(I add a text field at run time)
code1
Code:
Dim MyArray() As String
Dim n As Byte
______________________________
Private Sub Document_Open()
ReDim MyArray(10)
End Sub
______________________________
Private Sub txtField_Change()
n = 0
MyArray(n) = "No problem"
End Sub
code2(I add a text field at run time)
Code:
Dim MyArray() As String
Dim MyObject As Object
Dim n As Byte
______________________________
Private Sub Document_Open()
ReDim MyArray(10)
Set MyObject = ActiveDocument.InlineShapes.AddOLEControl("Forms.TextBox.1")
MyObject.OLEFormat.Object.Name = "txtField"
End Sub
______________________________
Private Sub txtField_Change()
n = 0
MyArray(n) = "Out of range"
End Sub