View Single Post
 
Old 02-17-2012, 07:07 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Marrick,

Assuming we're back to working with only the main story:
Code:
Sub ApplyCaptions()
Application.ScreenUpdating = True
Dim RngStry As Range, iShp As InlineShape, oTbl As Table, TmpRng As Range
With ActiveDocument
  For Each iShp In .InlineShapes
    Set TmpRng = iShp.Range.Paragraphs.First.Range
    With TmpRng
      If .Style <> "Caption" Then
        If .Paragraphs.Last.Next.Style <> "Caption" Then
          iShp.Range.InsertCaption Label:="Figure", TitleAutoText:="", _
           Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
        End If
      End If
    End With
  Next
  For Each oTbl In .Tables
    Set TmpRng = oTbl.Range.Paragraphs.Last.Range
    With TmpRng
      If .Paragraphs.Last.Next.Style <> "Caption" Then
        oTbl.Range.InsertCaption Label:="Figure", TitleAutoText:="", _
          Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
      End If
    End With
  Next
End With
Set TmpRng = Nothing
Application.ScreenUpdating = False
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote