Helmut said:
Hi JB,
hm..., I wonder,
with "option explicit" code shouldn't run at all, if a variable
wasn't declared (dim) . Without "option explicit", the variable is
dimensioned (declared) at runtime. What are the conditions, that
prevent the declaration? Or am I missing the point, and you want to
know, if the array, that didn't have an index, was redimensioned?
Then, have a look at this:
' option explicit
-----
Dim MyArray() As String
On Error Resume Next
MsgBox UBound(MyArray)
If Err.Number = 9 Then
MsgBox "no index" & Chr(13) & _
Err.Description
End If
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
Yeah Helmut..Sorry that's what I meant.
I thought there might have been a handy function like IsArray (I know
this is different) that could tell me if the array had an index?
It's the ReDim portion that I'm having trouble with as I'm trying to
write a text file with values from the doc custom styles and populate a
listbox with the custom style values.
Problem is when I come accross a doc that has no custom styles <g>
On Error GoTo CloseFile
count = UBound(aStyArrName()) + 1 'here if no index falls over!!
Open filename For Output As #filenumber
Print #filenumber, "[Setup]"
Print #filenumber, "TemplateName=" & frmStyles.txtTemplateName
Print #filenumber, "Count=" & count
Print #filenumber, ""
For i = 0 To count - 1
Print #filenumber, "[Style" & " " & i + 1 & "]"
Print #filenumber, "Name=" & aStyArrName(i)
Print #filenumber, "Size=" & aStyArrSize(i)
Print #filenumber, "FontType=" & aStyArrFont(i)
Print #filenumber, "StyleType=" & aStyArrStyleType(i)
Print #filenumber, ""
Next
CloseFile:
Close #filenumber
frmStyles.lstStyleNames.Clear
count = UBound(aStyArrName()) + 1
For i = 0 To count - 1
frmStyles.lstStyleNames.AddItem aStyArrName(i)
Next
etc.........
Any pointers?
J