Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2011, 10:03 AM
bcarlier bcarlier is offline Move existing table captions Windows Vista Move existing table captions Office 2003
Novice
Move existing table captions
 
Join Date: Aug 2011
Posts: 2
bcarlier is on a distinguished road
Default 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!
Reply With Quote
  #2  
Old 08-24-2011, 12:26 AM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 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]
Reply With Quote
  #3  
Old 08-24-2011, 12:55 AM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

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]
Reply With Quote
  #4  
Old 08-24-2011, 07:21 AM
bcarlier bcarlier is offline Move existing table captions Windows Vista Move existing table captions Office 2003
Novice
Move existing table captions
 
Join Date: Aug 2011
Posts: 2
bcarlier is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
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.
Thanks for your reply, and for pointing out that link!

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.
Reply With Quote
  #5  
Old 09-04-2011, 02:37 AM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 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
There's no error-checking - the code simply moves whatever paragraph follows each table to before the table.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 01-23-2012, 04:24 PM
ɔkyeame ɔkyeame is offline Move existing table captions Windows 7 32bit Move existing table captions Office 2010 32bit
Novice
 
Join Date: Jan 2012
Posts: 1
ɔkyeame is on a distinguished road
Thumbs up 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!
Reply With Quote
  #7  
Old 01-24-2012, 12:56 AM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 ɔkyeame,

Thanks for the feedback.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 07-02-2012, 09:00 PM
Blackstar Blackstar is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 64bit
Novice
 
Join Date: Jul 2012
Posts: 1
Blackstar is on a distinguished road
Default

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.
Reply With Quote
  #9  
Old 07-02-2012, 09:07 PM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 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]
Reply With Quote
  #10  
Old 07-29-2012, 01:51 PM
Bsmout Bsmout is offline Move existing table captions Windows XP Move existing table captions Office 2003
Novice
 
Join Date: Jul 2012
Posts: 2
Bsmout is on a distinguished road
Default 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?
Reply With Quote
  #11  
Old 07-29-2012, 03:27 PM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 64bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 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]
Reply With Quote
  #12  
Old 07-29-2012, 04:18 PM
Bsmout Bsmout is offline Move existing table captions Windows XP Move existing table captions Office 2003
Novice
 
Join Date: Jul 2012
Posts: 2
Bsmout is on a distinguished road
Default Thanks Paul

Thanks for responding Paul - I guess I'll do them one by one.

Thanks,
Bsmout
Reply With Quote
  #13  
Old 10-23-2013, 08:27 AM
nanivelez nanivelez is offline Move existing table captions Windows 8 Move existing table captions Office 2010 64bit
Novice
 
Join Date: Oct 2013
Posts: 2
nanivelez is on a distinguished road
Default 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
Reply With Quote
  #14  
Old 10-23-2013, 03:15 PM
macropod's Avatar
macropod macropod is offline Move existing table captions Windows 7 32bit Move existing table captions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

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]
Reply With Quote
  #15  
Old 10-24-2013, 08:55 AM
nanivelez nanivelez is offline Move existing table captions Windows 8 Move existing table captions Office 2010 64bit
Novice
 
Join Date: Oct 2013
Posts: 2
nanivelez is on a distinguished road
Default

macropod,

it is a 5.07 MB file with 12 tables, all containing only text.
Which other information might be helpful for you?

Carolina
Reply With Quote
Reply

Tags
table caption positioning

Thread Tools
Display Modes


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
Move existing table captions 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
Move existing table captions Captions (tables and figures) mcjohn Word 1 02-11-2010 10:36 PM
Captions dwilliams Word 0 10-07-2009 08:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft