#1
|
|||
|
|||
Find captions on Word
Hi everyone,
I am an amateur of VBA and have a problem that I have spent quite a while and still couldnt solve it, could anybody help me out please. Problem: I am using captions in Word to label charts and tables and have a list of figures which is generated by 'Insert table of Figures'. E.g. The list of figures is on P.1, below is the list of figures that I have Figure 1 ABC ... P.2 Figure 2 DEF ... P.3 What I would like to do is to have a VBA code that loops through the list and generates a message box during each step which includes the entire caption, e.g. For step 1, the message box would show 'Figure 1 ABC', for step 2, the message box would show 'Figure 2 DEF'. Please find attached a word document with the problem I described. Thank you! Please ask any questions, since I am not sure whether I have explained the problem clearly. |
#2
|
||||
|
||||
Do you mean like
Code:
Dim orng As Range Set orng = ActiveDocument.Range With orng.Find .Style = "Caption" Do While .Execute orng.Select MsgBox orng.Text orng.Collapse 0 Loop End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks gmayor
Thats exactly what i need! |
Tags |
captions, word vba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
insert caption | afshin | Word | 1 | 10-08-2016 03:41 PM |
Find a tag and replace that with a Caption in a Word doc using VBA .InsertCaption | Benble | Word VBA | 3 | 12-02-2014 03:42 AM |
Help with caption nightmare?? | justletmein | Word | 5 | 05-09-2014 06:30 PM |
Caption Dialog Box | mrice | Word | 1 | 05-22-2013 10:30 PM |
Tab in TOF or caption?... | JDB | Word | 1 | 12-02-2011 12:42 PM |