Hi Marrick,
Try:
Code:
Sub ApplyCaptions()
Application.ScreenUpdating = True
Dim oCap As CaptionLabel, bCap As Boolean, 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 bCap = ChkCaption(TmpRng)
If .Paragraphs.Last.Next.Range.Style = "Caption" And bCap = False Then
bCap = ChkCaption(TmpRng)
End If
If bCap = False Then
iShp.Range.InsertCaption Label:="Figure", TitleAutoText:="", _
Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
End If
End With
Next
For Each oTbl In .Tables
Set TmpRng = oTbl.Range.Paragraphs.Last.Range
With TmpRng
If .Style = "Caption" Then bCap = ChkCaption(TmpRng)
If .Paragraphs.Last.Next.Range.Style = "Caption" And bCap = False Then
bCap = ChkCaption(TmpRng)
End If
If bCap = False Then
oTbl.Range.InsertCaption Label:="Table", TitleAutoText:="", _
Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
End If
End With
Next
End With
Set TmpRng = Nothing
Application.ScreenUpdating = False
End Sub
Function ChkCaption(TmpRng As Range) As Boolean
Dim oCap As CaptionLabel
ChkCaption = False
For Each oCap In CaptionLabels
If InStr(TmpRng.Text, CaptionLabels(oCap)) > 0 Then
ChkCaption = True
Exit For
End If
Next
End Function
Depending on the # of tables & inlineshapes, this might take a while.