Insert Cross-Ref to last Caption by VBA?

E

Ed

(This was first posted to Word.Tables, where I asked about numbering tables.
I thought it might be better suited to this group. Sorry about the
double-post.)

Thanks to the heroic efforts of Jay Freedman and Suzanne Barnhill, I now
have half a handle on Captions and Cross-References. I think it will make
things easier - but first I have to implement these in a report already
written. I'm using these for table headers, and there's about 50 or so, so
I was going to put it all in a few quick macros to avoid a lot of repeated
motions.

Everything's okay, except for getting the cross-reference to automatically
choose the last / highest-numbered caption, which would be the one I just
put in. Every time I select Insert Cross-Reference, it gives me a list.
With the macro, I don't want to manually select the Caption - it will always
(for this effort) be the Caption I just inserted.

I couldn't see anything in the Help or VBA Help that would allow me to
specify which Caption to Cross-Reference. The VBA code for
InsertCrossReference has an argument for "ReferenceItem:=", and Help tells
me to use GetCrossReferenceItems, but I can't put it together to get the
last CrossReference inserted.

Any suggestions?

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top