![]() |
#1
|
|||
|
|||
![]()
I’m attempting to create a utility that inserts captions for shapes, inline shapes and tables (separately). The code is the attached Sub InsertCaptionImages1 module does just that for inline shapes except for two things:
1. It can count the inline shapes in all stories but insert captions only for those in the main body 2. If the document already has captions for inlineshapes (or other objects that can have captions), it adds additional captions. The idea of inserting captions separately for the three objects is that one might want to use different labels for each, such as “figure” for shapes and inline shapes; and “table” for tables; “equation” for something else; or a custom label as Word allows. That any standard label can be applied to any object type, and that any caption label can be user-defined, leads me to believe the only option is to somehow tie the field code SEQ to the object type. (I’ve been using the attached “Sub ShowSelectionType” module to have Word tell me the type of object I’ve selected.) I realize that captions and their text, if any, have no connection to the object for which they were created other than their initial placement, so I thought an approach for determining whether captions exist was to loop through the specific shape collection and detect whether each has a SEQ field, then ignore those that do and insert the caption for those that don’t. That might work in theory, but with my very limited VBA, I am not having any success in executing this idea, as evidenced by my stabs at it in Sub InsertCaptionImages2 (beginning about halfway down the module). I found some code that deletes captions and all of the text associated with them, which I tried to adapt for the unique insertion code, but didn’t succeed (that code is included in the attachment as “Sub DeleteCaptionNumText”). There is also the fact that when you manually insert a caption for a shape, Word creates a small text box and writes the caption number and label in it. For inline shapes, the caption label and text are written in the body. I don’t know if this affects anything here, but I thought I’d mention it. So is it possible to insert captions separately for shapes, inline shapes and tables without appending to existing captions? If not, I will just abandon the effort and make a note to run the Sub InsertCaptionImages1 only once…. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
bcarlier | Word Tables | 17 | 05-10-2014 02:36 PM |
Captions/Styles | NWoffice | Word | 5 | 10-06-2011 10:26 AM |
![]() |
gib65 | Word | 2 | 08-12-2011 01:25 PM |
![]() |
mcjohn | Word | 1 | 02-11-2010 10:36 PM |
Captions | dwilliams | Word | 0 | 10-07-2009 08:30 AM |