Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-14-2016, 10:12 AM
frank1028 frank1028 is offline Find captions on Word Windows 10 Find captions on Word Office 2016
Novice
Find captions on Word
 
Join Date: Dec 2016
Posts: 2
frank1028 is on a distinguished road
Default 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.
Attached Files
File Type: docx Sample.docx (14.7 KB, 18 views)
Reply With Quote
  #2  
Old 12-14-2016, 09:49 PM
gmayor's Avatar
gmayor gmayor is offline Find captions on Word Windows 10 Find captions on Word Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 12-15-2016, 01:52 PM
frank1028 frank1028 is offline Find captions on Word Windows 10 Find captions on Word Office 2016
Novice
Find captions on Word
 
Join Date: Dec 2016
Posts: 2
frank1028 is on a distinguished road
Default

Thanks gmayor

Thats exactly what i need!
Reply With Quote
Reply

Tags
captions, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find captions on Word insert caption afshin Word 1 10-08-2016 03:41 PM
Find captions on Word 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
Find captions on Word Tab in TOF or caption?... JDB Word 1 12-02-2011 12:42 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft