View Single Post
 
Old 11-29-2014, 09:56 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote