Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2018, 04:59 AM
gmayor's Avatar
gmayor gmayor is offline Macro to add captions to pictures inside word document Windows 10 Macro to add captions to pictures inside word document Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 ofgmayor has much to be proud of
Default


Maybe something like


Code:
Sub Macro1()
Dim oCell As Cell
Dim oShape As InlineShape
    With ActiveDocument.Styles("Caption").Font
        .Name = "Arial"
        .Size = 9
        .Color = wdColorAutomatic
    End With

    For Each oCell In Selection.Tables(1).Range.Cells
        If oCell.Range.InlineShapes.Count = 1 Then
            Set oShape = oCell.Range.InlineShapes(1)
            oShape.Range.InsertCaption _
                    Label:="Figure", _
                    TitleAutoText:="InsertCaption1", _
                    Title:="", _
                    Position:=wdCaptionPositionBelow, _
                    ExcludeLabel:=0
        End If
        DoEvents
    Next oCell
lbl_Exit:
    Set oShape = Nothing
    Set oCell = Nothing
    Exit Sub
End Sub
__________________
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
Reply

Tags
automatic figure caption



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to add captions to pictures inside word document VBA to insert captions without appending to existing captions Marrick13 Word VBA 17 03-21-2023 07:51 PM
Macro to add captions to pictures inside word document Help formatting Pictures inside a Text Box in Word 2013 jstumbo87 Word 2 01-29-2014 12:07 PM
Macro to add captions to pictures inside word document Macro to read word document harishankar.selvaraju Excel Programming 1 06-14-2012 03:48 AM
Where we can find a Word document (docx file) that contains professional work inside? Jamal NUMAN Word 0 06-26-2011 09:57 AM
Captions and Figures Inside a Frame...RIDICULOUS MS hasn't developed a solution!!! stlsmiln Word 2 02-23-2010 02:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:50 AM.


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