Re: List of cross-references based on custom style by david
david
Fri Apr 20 10:24:01 CDT 2007
Mike:
Actually, my dialog box does include bookmarks, but I didn't want to dump
too much detail on Jennifer in one slug. I have six types, the sixth being
"Other." Selecting other enables a list box, in which I've listed all the
other types found in the document, one of which may well be bookmarks.
I just updated my profile with a decipherable e-mail address, and if you can
contact me offlist, I'd be happy to try to send you a copy of my x-ref
replacement. I can't promise it quickly, as I'd have to strip out proprietary
stuff to make it "sterile." Also bear in mind that it's only tested on Word
2000.
Bear
--
Windows XP, Word 2000
"Mike Starr" wrote:
> I know just enough to be really interested in what you're doing here but not
> enough to be of any assistance. I haven't had the opportunity to study VBA
> enough to understand it at a detail level. However, I'd certainly love to
> see the final outcome of your work... the existing xref dialog box is the
> bane of my existence (well, that and kitties stomping across my keyboard but
> that's a whole different story, isn't it?).
>
> One thing to add to Bear's list would be bookmarks (present in the existing
> dialog box).
>
> Mike
> "Jennifer H" <JenniferH@discussions.microsoft.com> wrote in message
> news:B7BD16F6-045C-46A6-9467-B0D8D236CC1E@microsoft.com...
> > Bear, you've been reading my mind ;-)
> >
> > I've already produced the user form with the radio buttons and was
> starting
> > to tackle the matter of repopulating the list based on the selected radio
> > button. Your solution came at exactly the right time.
> >
> > As to the FormatList box and other options, I intend to hardcode these to
> > comply with company standards. But will set a variable for the reference
> kind
> > (varRefKind) when a radio button is selected, to cover the difference
> between
> > captions (figures & tables) and numbered items (headings and auto
> numbers).
> >
> > Thanks,
> > Jennifer
> >
> > "Bear" wrote:
> >
> > > Jennifer:
> > >
> > > I think an appropriate strategy would be a group of radio buttons to
> select
> > > the type:
> > >
> > > Figure
> > > Table
> > > Chapter
> > > Appendix
> > > Headings
> > >
> > > so the user could zero in on the type of object he's cross-referencing,
> or
> > > select Headings and see all the Chapter, Appendix, and topic headings.
> > >
> > > Each click event would repopulate a list of objects of that type.
> > >
> > > You'd also want a customized Format list box to present the formats you
> > > actually use, and maybe checkboxes for Hyperlink (which we default to
> > > cleared, i.e. no hyperlinks) and Use "On Page" to reproduce the most
> helpful
> > > built-in options. We also have a Company Format check box which disables
> all
> > > the formatting options and just inserts the cross-reference in our
> "approved"
> > > format for each type.
> > >
> > > Here's my generic sub that fills the item list when the type option
> button
> > > changes. The variant variables are global to the userform, so they're
> defined
> > > in General Declarations at the beginning of the form code.
> > >
> > > Dim varXRefs As Variant
> > > Dim varRefType As Variant
> > >
> > > Sub UpdateItemList()
> > >
> > > ' Use varRefType to fill the Item list accordingly
> > >
> > > Me.lstItem.Clear
> > >
> > > varXRefs = ActiveDocument.GetCrossReferenceItems _
> > > (ReferenceType:=varRefType)
> > > For Index = 1 To UBound(varXRefs)
> > > Me.lstItem.AddItem varXRefs(Index)
> > > Next Index
> > >
> > > If Me.lstItem.ListCount > 0 Then
> > > Me.lstItem.ListIndex = 0
> > > Me.cmdInsert.Enabled = True
> > > Else
> > > Me.cmdInsert.Enabled = False
> > > End If
> > >
> > > End Sub
> > >
> > > So the GetCrossReferenceItems is being loaded into the variant varXRefs,
> > > which becomes an array. I only get the cross-reference items of the type
> the
> > > user wants, as indicated by the previously set varRefType. Then I run
> through
> > > the array and add each item in it to my userform list.
> > >
> > > Check the object browser for WdReferenceType to see what you can ask
> for. An
> > > obscure factoid is that for captions (figures, tables, equations, etc.)
> you
> > > can set varRefType to the caption name.
> > >
> > > Bear
>
>
>