#1
|
|||
|
|||
Changing figures' caption from bottom to above
I have many figures in my document, those figures have their captions at the bottom. I need to move the caption to above. How can I achieve that? preferably, change them in batch mode or macro. I found a macro online to change caption for tables from bottom to above, but couldn't get it to work with figures. Code:
Sub UpdateTables() Application.ScreenUpdating = False Dim i As Long, oPrev As Range, oNext As Range With ActiveDocument For i = .Tables.Count To 1 Step -1 With .Tables(i).Range Set oPrev = .Characters.First.Previous.Characters.Last Set oNext = .Characters.Last.Next.Paragraphs.First.Range With oPrev .InsertBefore vbCr .Start = .End - 1 .Style = oNext.Style .End = .Start If Len(oNext.Text) > 1 Then With oNext .End = .End - 1 .Cut .Delete End With .Paste Else oNext.Delete End If End With End With Next End With Application.ScreenUpdating = True End Sub Last edited by Charles Kenyon; 05-12-2018 at 10:03 AM. |
#2
|
|||
|
|||
I do not know that this will work, but know that looping through the tables won't change anything for non-tables.
Try: Code:
Sub UpdateFigureCaptions() Application.ScreenUpdating = False ' Charles Kenyon Dim i As Long, oPrev As Range, oNext As Range With ActiveDocument For i = .Figures.Count To 1 Step -1 With .Figures(i).Range Set oPrev = .Characters.First.Previous.Characters.Last Set oNext = .Characters.Last.Next.Paragraphs.First.Range With oPrev .InsertBefore vbCr .Start = .End - 1 .Style = oNext.Style .End = .Start If Len(oNext.Text) > 1 Then With oNext .End = .End - 1 .Cut .Delete End With .Paste Else oNext.Delete End If End With End With Next End With Application.ScreenUpdating = True End Sub |
#3
|
|||
|
|||
Thanks Charles. Yea I understand it won't work as it since it's looping over tables. I actually used this macro to update tables caption and it worked great. I tried to change "Tables" in macro but couldn't find exact one used for figures. I tried your version of code and unfortunately it didn't work. It says "Object doesn't support this property or method" and it's indicating "Figures"
|
#4
|
|||
|
|||
Try Objects.
Sorry, I'm kind of busy and am not trying to write your code. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
List of figures with several labels (caption) - Table of Figures sorting | ibra_ca | Word | 2 | 10-11-2017 07:02 AM |
Automatic table of figures includes one of the figures, not just the caption - help! | sarahlt | Word | 1 | 09-28-2014 09:34 AM |
Table of Figures repeats caption references. | jorgensene | Word | 1 | 08-13-2014 03:51 PM |
Using Insert Caption/List of figures | rezza22 | Word | 2 | 05-12-2013 09:39 AM |
Caption and Table of Figures issue | reece22345 | Word | 3 | 04-15-2011 12:18 AM |