Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-22-2023, 11:05 AM
David Peck David Peck is offline vba renumbering paragraph numbers each in top right cell of a series of table Windows 10 vba renumbering paragraph numbers each in top right cell of a series of table Office 2021
Novice
vba renumbering paragraph numbers each in top right cell of a series of table
 
Join Date: Jun 2023
Posts: 3
David Peck is on a distinguished road
Default vba renumbering paragraph numbers each in top right cell of a series of table

I have a document with a series of tables containing a photo in the upper left cell and a description including a auto-numbered paragraph in the upper right cell.



I have used this code to insert the list number

With ListGalleries(wdNumberGallery).ListTemplates(1).Li stLevels(1)

Select Case Trim(gCapType)
Case "Photo"
.NumberFormat = "Photo %1:"
PrevCaptionType = "Photo"
Case "Figure"
.NumberFormat = "Figure %1:"
PrevCaptionType = "Figure"
Case "Illustration"
.NumberFormat = "Illustration %1:"
PrevCaptionType = "Illustration"
Case "Scan"
.NumberFormat = "Scan %1:"
PrevCaptionType = "Scan"
Case "User Specified"
'NEED CODE HERE TO HANDLE SPECIAL CASE
End Select

.TrailingCharacter = wdTrailingNone
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.5)
.TabPosition = wdUndefined
.ResetOnHigher = 0
'.StartAt = 1
.Font.Bold = True
.LinkedStyle = ""
End With

Selection.Range.ListFormat.ApplyListTemplate _
ListTemplate:=ListGalleries(wdNumberGallery).ListT emplates(1), _
ContinuePreviousList:=True, _
ApplyTo:=wdListApplyToSelection, _
DefaultListBehavior:=wdWord10ListBehavior

'UPDATE THE CAPTION NUMBER
Selection.Range.Fields.Update


the lists have no trouble renumbering when I delete a table from the sequence, but when insert a new table with its associated data in many circumstances it does not update the field with the new numbering.

I have tried several methods to update the field including reselecting each cell with an expected change and applying Selection.Range.Fields.Update

I have also tried looping through the fields in the fields collection.

Neither approach updates all of the cases for inserting before or after the originally selected table and at the boundary conditions for the beginning and ending of the section. A section break is used when the paragraph label changes (ie. "Photo:" to "Figure:")

Any suggestions for a way to force the renumbering to happen reliably would be welcome.
Reply With Quote
 

Tags
renumber para # fields



Similar Threads
Thread Thread Starter Forum Replies Last Post
table cell values to another word document paragraph abonsey Word VBA 3 06-16-2022 04:36 AM
vba renumbering paragraph numbers each in top right cell of a series of table Why do numbers show up a little lower in table cell? HealthyStealthy Word 2 09-06-2016 06:36 AM
Replace 0000s with a series of numbers tingker Word VBA 2 12-17-2014 06:06 AM
vba renumbering paragraph numbers each in top right cell of a series of table Moving up/ down a paragraph within a Table Cell by using keyboard Joey Cheung Word Tables 1 08-12-2014 05:19 PM
Remove Paragraph numbers from Table of Co Bu_zz2020 Word 3 08-27-2013 08:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:48 AM.


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