![]() |
|
|
|
#1
|
||||
|
||||
|
Try running the following macro after the AddImageCaptionTables macro (you can call this one from that one): Code:
Sub AddCaptionText()
Dim Tbl As Table, RngCell As Range, RngRef As Range, StrTxt As String
For Each Tbl In ActiveDocument.Tables
Set RngCell = Tbl.Range.Cells(Tbl.Range.Cells.Count).Range
With RngCell
.End = .End - 1
.Collapse wdCollapseEnd
If .Style = "Caption" Then
Set RngRef = .Paragraphs.Last.Next.Next.Range
With RngRef
.End = .End - 1
If .Fields.Count = 1 Then
If .Fields(1).Type = wdFieldIndexEntry Then
StrTxt = Trim(Replace(Replace(.Fields(1).Code.Text, "XE ", _
vbNullString, , , vbTextCompare), Chr(34), ""))
With RngCell
.Text = ": " & StrTxt
.Collapse wdCollapseEnd
.FormattedText = RngRef.FormattedText
End With
.Paragraphs.First.Range.Delete
End If
End If
End With
End If
End With
Next
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| automatic figure caption |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
VBA to insert captions without appending to existing captions
|
Marrick13 | Word VBA | 17 | 03-21-2023 07:51 PM |
Help formatting Pictures inside a Text Box in Word 2013
|
jstumbo87 | Word | 2 | 01-29-2014 12:07 PM |
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 |