I have Table of Contents working fine. I can't get a Table Of Figures to work, however. I have tried setting the Caption property, but I still get "No Tables of Figures Entries Found". Anybody, HELP! Thanks.

Recommended Answers

All 12 Replies

Which version of MS Word are you using, 2007 or 2010?

Also have a look at THIS link, might contain your answer.

I am developing for either. To this point, I have been careful to only use methods that are available in both.

Did you have a look at the link I gave, you might have missed something when trying to set the caption.

I just read the link you provided, which I have seen before. It speaks only to the "manual" method. I am aware that I can record a macro and review it, but seeing a few lines of sample code is so much more informative as you have to separate all that you don't need from that which you do when looking at macros.

Ahh, more information. :)

So you are trying to set the caption via a macro right? If so, show the code you are using and where the error occurred.

Sorry, the title of my post included "Word Automation", and I am using the automation object.

No, I am actually using the Progress ABL to drive the MSWORD.OLB object. I create the TOF point at the top of the document creation, just like I do for the TOC. I update the TOF at the end, just like I do the TOC. The Table of Contents works great. I just cannot identify the right method for saying that "this text here is one of my captions". I looked at the caption method, but although I get no errors, it does nothing.

To setup the TOF:
chwordapplication:SELECTION:TypeParagraph().

To set a caption (not working):
chDoc:TablesOfFigures:ITEM(1):caption = "My Caption".

To update the TOF (generates the No Tables of Figures Entries Found):
chTOF = chDoc:TablesOfFigures:ITEM(1).
chTOF:UPDATE().

I am sorry to say that this is out of my depth. Never worked with tables of figures.

It might be that the entries is in the drawing layer and not in the floating object. See this for more info. Other than that, sorry I can't be of more help.

Interesting, but I used the "record macro" method and found that the InsertCaption method is apparently the method to use on the SELECTION or RANGE object. Fine, but now I get an error "Command Failed" (great message), with error code 0x80020009. Not finding much that helps on the web with that error.

Resolved... the first argument to InsertCaption has to be a numeric like -1 to indicate the table (figures, graphs, etc.). The 2nd argument is the string. Thanks for trying.

commented: Sorry I couldn't do more... +12

Sorry I couldn't do more. Glad you could solve it though. Some kudos. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.