#1
|
|||
|
|||
Move existing table captions
How can I move all existing table captions from below the table to above the table without having to re-insert them one by one? The existing figure captions should remain below (the figure). Thanks! |
#2
|
||||
|
||||
Hi bcarlier,
You'd need a macro to do that. Before anyone could even start coding such a macro, they'd need to know whether: 1. All tables have captions; 2. All captions use Word's Caption Style (or another unique Style that can't be confused with anything else); and 3. Whether anything other than tables is captioned.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Cross-posted at: http://www.officekb.com/Uwe/Forum.as...table-captions
For cross-posting etiquette, please read: http://www.excelguru.ca/node/7
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Quote:
In reply to your questions: yes, all tables have captions and have the same style. Figures, however, are also captioned and have the same style. But, I don't want the figure captions to be moved. |
#5
|
||||
|
||||
Hi bcarlier,
Based on what you've said, try: Code:
Sub ReLabelTables() 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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Amazing!!!
I registered for this forum just to thank you. I have 250+ tables in a 179 page document (yes, I'm working on my thesis...that's chapter 3's data analysis) and you just saved me a good day's worth of work. This worked flawlessly in moving each caption up to above its table. No one made a comment after you, but I did want to confirm that this works and it works perfectly. I really appreciate it!
|
#7
|
||||
|
||||
Hi ɔkyeame,
Thanks for the feedback.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
I've been looking through all the internet to find this same issue and here is the only place I've found the answer and see that really worked for someone but I don't know how you enter this code and I have another doubt: if I changed the default label name and style, this code still works, Thank you.
|
#9
|
||||
|
||||
Hi Blackstar,
For instructions on installing & using the macro, see: http://www.gmayor.com/installing_macro.htm The code doesn't do any checking of label names or Styles, it simply assumes you want whatever paragraph appears after the table is to be relocated before it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Move existing figure captions
Hi Macropod,
I have the opposite problem - The table captions are correct but I have over 500 figure captions above the figures and I need to move them to below. My home machine is Windows XP Word 2003. Can you please do a similar magic macro to help? |
#11
|
||||
|
||||
hi Bsmout,
For captions relating to objects other than tables, it can be much more difficult to program. If the objects are formatted as anything other than in-line with text, it can be extremely difficult, as there may be no apparent relationship (other than a visual one that means little to vba) between the object's position on the page and its caption. Furthermore, even for objects formatted as in-line with text, one would need to handle them differently if they're part of the paragraph containing the caption, are in a paragraph of their own or are attached to a different paragraph. None of these considerations apply with most tables.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Thanks Paul
Thanks for responding Paul - I guess I'll do them one by one.
Thanks, Bsmout |
#13
|
|||
|
|||
error running macro
Hello macropod,
I am trying to run the macro but I am getting the following error: Run-time error '5844' one of the values passed to this method or property is incorrect. Could you please help me with this?? Thanks a lot |
#14
|
||||
|
||||
I am unable to reproduce that error. Can you give more details about the document you're working with and the table at which the code fails?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
macropod,
it is a 5.07 MB file with 12 tables, all containing only text. Which other information might be helpful for you? Carolina |
Tags |
table caption positioning |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to edit the "Format" and the "show level" of an EXISTING table of content? | Jamal NUMAN | Word | 2 | 08-14-2011 10:46 AM |
How to have the words existing in the same Outline Level to be in the Table of Conten | Jamal NUMAN | Word | 1 | 04-15-2011 06:26 PM |
Word 2010 image and table captions style | chaji | Word | 0 | 09-22-2010 03:59 PM |
Captions (tables and figures) | mcjohn | Word | 1 | 02-11-2010 10:36 PM |
Captions | dwilliams | Word | 0 | 10-07-2009 08:30 AM |