Marrick,
For the first issue simply add the following after the line strFieldData() = fncFieldData:
Code:
strFieldData() = fcnFieldData
On Error Resume Next
lngIndex = LBound(strFieldData, 1)
If Err.Number <> 0 Then
MsgBox ("There are no AutoTextLink fields in this document."), , "Field Count"
Exit Sub
End If
On Error GoTo 0
If you want to know how many fields there are that is available from the array as well:
Code:
MsgBox "There are " & UBound(strFieldData, 2) + 1 & " autotext fields in the processed document."
The array after processing your new sample text begins life as unallocated array:
Dim strFieldData()
After the function it is allocated and dimensioned as like this:
strFieldData(2, 21). Since the array is zero based, the count of fields is 22.