Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-11-2019, 05:06 PM
WordUser789 WordUser789 is offline Keeping or restoring "Start at" value for heading list after updating styles from a template Windows 10 Keeping or restoring "Start at" value for heading list after updating styles from a template Office 2016
Novice
Keeping or restoring "Start at" value for heading list after updating styles from a template
 
Join Date: Jun 2017
Posts: 25
WordUser789 is on a distinguished road
Default Keeping or restoring "Start at" value for heading list after updating styles from a template

I have a macro that I use quite often when other people have been working on a document I created from a template, and have messed up the styles by pasting in things from elsewhere etc: essentially it performs the steps of linking the document to the correct template, ticking the "Automatically update document styles" box, pressing ok, then going back in and unticking the box. This is my standard way to getting the style list back in order.



It falls down when I have a document where the headings don't start at 1 though, which happens when I am doing a tender with (for example) Schedules from 1-10 and they want the numbering for Schedule 3 to start at 3.1. I do this by going into the list style and setting "Start at" to "3", and so on. When I update the styles, this value is set back to 1 and I need to go in and manually change it back to what it should be.

I figured I could get my macro to do this by setting a variable with the current value of "Startat", perform the linking/updating steps, then set it back with the value in the variable. My knowledge of VBA is quite poor: below is my current macro with a lame attempt at new code in blue (which obviously doesn't work) and in red explaining what I want to do: I'm hoping someone can suggest the correct code!


------


Sub ScheduleUpdateStylesFromTemplate()
'
Dim x as long (??)

Set x = ListGalleries(wdOutlineNumberGallery).ListTemplate s(1).ListLevels(1).StartAt
Here I want to set the variable "x" with the current value of "StartAt" for my "Numbered Headings" List Style, so I think I also need to reference that the list style is "Numbered Headings" somewhere??

With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = _
"Y:\RFT Template.dotx"
End With
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = _
"Y:\RFT Template.dotx"
End With

With ListGalleries(wdOutlineNumberGallery).ListTemplate s(1).ListLevels(1)
.StartAt = x
End With

Here I want to set the "StartAt" value for "Numbered Headings"to be the value of "x" that I captured before I refreshed the styles

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping or restoring "Start at" value for heading list after updating styles from a template Custom Template, Multi-List Heading Numbers Reverting to Template Rather than Keeping Local Change whsnow Word 2 03-24-2018 06:57 AM
Keeping or restoring "Start at" value for heading list after updating styles from a template Heading styles come "unlinked" from Multi-level list levels after save. spthomas Word 3 11-27-2013 03:55 PM
2 "autonumbers" in 1 list heading? christie Word 0 08-01-2011 08:24 AM
Keeping or restoring "Start at" value for heading list after updating styles from a template How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM
Word 2007 template "Restart at 1" changes styles BuzzyG Word 0 06-10-2011 01:19 PM

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