B
Bonsai Bill
I use inserts extensively so I generated a form and wrote macros to insert
figures, tables, etc. I also wrote similar macro to cross-reference the
inserts.
In the cross-referencing form I have text box to tell which figure or table
number is to be used. Everything works fine, usually. But sometimes the
numbering goes wrong when cross-referencing, either while I have Track
Changes on or have them on. For example I enter 8 for figure number and macro
inserts 4. Stepping through macro the value remains correct going to
InsertCrossReference.
If using the macro to insert caption the correct number is shown, e.g. 8.8.
But I try inserting manually, Word offers Figure 1.8! However, I can select
the correct cross-reference. I have tried exiting program, and loading
another file and then returning to problem file but that made no difference
Can someone please offer a way to avoid this strange behavior? I am using
Word XP. Thanks for your help.
The simple code for cross-referencing is:
RStr = Str(Num) ' Num and myType come from form
If myType = "f" Then
myStr = "Figure " + RStr
Selection.InsertCrossReference ReferenceType:="Figure", ReferenceKind:= _
wdOnlyLabelAndNumber, ReferenceItem:=RStr, InsertAsHyperlink:=False, _
IncludePosition:=False
Selection.TypeText Text:=" "
FigCt = frmCrRef.tbNum.Value + 1
frmCrRef.tbNum.Value = Str(FigCt)
End If
figures, tables, etc. I also wrote similar macro to cross-reference the
inserts.
In the cross-referencing form I have text box to tell which figure or table
number is to be used. Everything works fine, usually. But sometimes the
numbering goes wrong when cross-referencing, either while I have Track
Changes on or have them on. For example I enter 8 for figure number and macro
inserts 4. Stepping through macro the value remains correct going to
InsertCrossReference.
If using the macro to insert caption the correct number is shown, e.g. 8.8.
But I try inserting manually, Word offers Figure 1.8! However, I can select
the correct cross-reference. I have tried exiting program, and loading
another file and then returning to problem file but that made no difference
Can someone please offer a way to avoid this strange behavior? I am using
Word XP. Thanks for your help.
The simple code for cross-referencing is:
RStr = Str(Num) ' Num and myType come from form
If myType = "f" Then
myStr = "Figure " + RStr
Selection.InsertCrossReference ReferenceType:="Figure", ReferenceKind:= _
wdOnlyLabelAndNumber, ReferenceItem:=RStr, InsertAsHyperlink:=False, _
IncludePosition:=False
Selection.TypeText Text:=" "
FigCt = frmCrRef.tbNum.Value + 1
frmCrRef.tbNum.Value = Str(FigCt)
End If