D
Debra Ann
I have a program that pulls up the cross-references for any existing figures
in a dropdown box. This program has not problem showing the figures if there
are 1 to 8 figures; however, if there are more than eight figures in the
document, you don't see them listed. Please let me know why you think this
is happening. Thanks,
Here is the code:
Private Sub UserForm_Initialize()
Dim varXRefs As Variant
Dim Index As Integer
Selection.Fields.Update
' Clear out any previous contents
Me.cboFigureNumber.Clear
' Load just the figures into varXRefs
varXRefs = ActiveDocument.GetCrossReferenceItems _
(ReferenceType:="Figure")
' Load the ListBox from varXRefs as an array
For Index = 1 To UBound(varXRefs)
Me.cboFigureNumber.AddItem varXRefs(Index)
Next Index
' Test whether the list has any entries and
' set command buttons accordingly
If Me.cboFigureNumber.ListCount > 0 Then
Me.cboFigureNumber.ListIndex = 0
Me.cmdInsert.Enabled = True
Else
MsgBox ("There are no figures to cross-reference.")
ReferenceFigure.Hide
End If
End Sub
in a dropdown box. This program has not problem showing the figures if there
are 1 to 8 figures; however, if there are more than eight figures in the
document, you don't see them listed. Please let me know why you think this
is happening. Thanks,
Here is the code:
Private Sub UserForm_Initialize()
Dim varXRefs As Variant
Dim Index As Integer
Selection.Fields.Update
' Clear out any previous contents
Me.cboFigureNumber.Clear
' Load just the figures into varXRefs
varXRefs = ActiveDocument.GetCrossReferenceItems _
(ReferenceType:="Figure")
' Load the ListBox from varXRefs as an array
For Index = 1 To UBound(varXRefs)
Me.cboFigureNumber.AddItem varXRefs(Index)
Next Index
' Test whether the list has any entries and
' set command buttons accordingly
If Me.cboFigureNumber.ListCount > 0 Then
Me.cboFigureNumber.ListIndex = 0
Me.cmdInsert.Enabled = True
Else
MsgBox ("There are no figures to cross-reference.")
ReferenceFigure.Hide
End If
End Sub