Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2013, 08:13 AM
ragesz ragesz is offline How to AutoCaption existing tables Windows 7 64bit How to AutoCaption existing tables Office 2007
Novice
How to AutoCaption existing tables
 
Join Date: Oct 2012
Posts: 14
ragesz is on a distinguished road
Default How to AutoCaption existing tables

Dear All!



Is it possible to use the AutoCaption function for existing tables? My Word document has so many tables without numbering and labelling, and I want use the AutoCaption for these tables.
Is it possible to use AutoCaption for images? Maybe via VB macros?

Thank you for reading and trying to help me!
Reply With Quote
  #2  
Old 09-03-2013, 06:06 PM
fumei fumei is offline How to AutoCaption existing tables Windows 7 64bit How to AutoCaption existing tables Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

No, you can not use AutoCaption for existing tables. It is automatic for NEW tables. You can add Caption though to existing tables using something like:
Code:
Sub addCAP()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
oTbl.Select
Selection.InsertCaption Label:="Table", TitleAutoText:="", Title:="", _
Position:=wdCaptionPositionAbove
Next
End Sub
Reply With Quote
  #3  
Old 09-04-2013, 02:34 AM
ragesz ragesz is offline How to AutoCaption existing tables Windows 7 64bit How to AutoCaption existing tables Office 2007
Novice
How to AutoCaption existing tables
 
Join Date: Oct 2012
Posts: 14
ragesz is on a distinguished road
Default

Thank you fumei!

It works well with tables! I already had captions without label and number for my tables so I signed them with special characters (#table_caption_start# /...end#) then I searched these caption (With Selection.Find .Execute FindText:="#table_caption_start#",...) and used it at InsertCaption at Title.

Here is the code:
Code:
Sub addTableCAP2()
Dim objTable As Table
Dim rngTable As Range
Dim strTable As String
For Each objTable In ActiveDocument.Tables
  With Selection.Find
    .Execute FindText:="#table_caption_start#", Forward:=True, MatchWholeWord:=False, _
    MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=False
    Set rngTable = Selection.Range
    rngTable.End = ActiveDocument.Range.End
    rngTable.End = rngTable.Start + InStr(rngTable, "end#")
    rngTable.End = rngTable.End + 4
    strTable = Replace(rngTable.Text, "#table_caption_start#", "")
    strTable = Replace(strTable, "#table_caption_end#", "")
    strTable = Left(strTable, Len(strTable) - 1)
    rngTable.Text = ""
    objTable.Select
    Selection.InsertCaption Label:="Table", TitleAutoText:="", Title:=" - " + strTable, _
    Position:=wdCaptionPositionAbove
  End With
Next
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add columns to existing tables? dpcalder Word 1 08-06-2013 09:49 AM
How to AutoCaption existing tables Edit of existing report abbertonian Project 3 04-10-2013 07:56 AM
How to add to an existing animation karenw PowerPoint 0 10-14-2011 05:51 AM
Formatting existing text Kaila Word 0 09-03-2011 05:40 PM
How to AutoCaption existing tables Updating Existing Information akshaygopale Office 5 06-22-2011 06:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:33 PM.


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