You should declare ListLev as ListLevel instead of as Long.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Resetting a number in the middle of a list (Word 2003 VBA)
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Resetting a number in the middle of a list (Word 2003 VBA)
- This topic has 17 replies, 4 voices, and was last updated 18 years, 8 months ago.
Viewing 1 reply threadAuthorReplies-
WSTroyWells
AskWoody LoungerSeptember 6, 2006 at 6:33 pm #1027458 -
WSHansV
AskWoody Lounger -
WSTroyWells
AskWoody Lounger -
WSHansV
AskWoody Lounger
-
-
-
-
WSTroyWells
AskWoody LoungerSeptember 6, 2006 at 6:34 pm #1027453(Edited by TroyWells on 06-Sep-06 19:34. )
I am trying to reset a list item number from 1 to 3 (or another number I calculate from a variable) in the middle of a list. Do to the dummy restart styles I have at the beginning of my list and how I have to use them, the numbers are restarting prematurely. Calculating the variable is no problem. Resetting the number is. I have tried using the following code:
Dim List1 As Long
Dim ListNumberBefore as IntegerSet List1 = ListGalleries(wdOutlineNumberGallery).ListTemplates(Selection.Range.ListFormat.ListTemplate.Name).ListLevels(Selection.Range.ListFormat.ListLevelNumber)
With List1
.StartAt = ListNumberBefore + 1
End WithHowever, I get the following error:
Compile error. Object required.
Please advise what I am doing wrong or if there is a better way.
Thanks!!
Troy -
WSStuartR
AskWoody Lounger -
WSTroyWells
AskWoody LoungerSeptember 7, 2006 at 6:10 am #1027501This code works in that it causes no error. The problem is that it causes all the lists in the entire document to start at whatever value is set here. In other words, if I want to change the startat value from “a” to “c”, all lists at that level in the entire document now start at “c”.
Any other ideas?
Thanks!!
Troy -
WSStuartR
AskWoody LoungerSeptember 7, 2006 at 2:54 pm #1027588In that case I think this is going to get very complex, as I think you will need to create a new ListTemplate with a new name for each different starting number. Unless someone else has a brighter idea.
Do all your ListTemplates already have names that you have defined and could use in a Macro? This might make it easier.
StuartR
-
WSTroyWells
AskWoody LoungerSeptember 7, 2006 at 3:30 pm #1027595I have a single list template named “myListItems”. It is a multilevel list where the first two levels are dummy list items that are tied to specific styles that help it restart.
Thus my problem. When the styles appear, say in a table, and the list continues, it starts over at 1. I can manually change it to start at whatever I want, but I’d prefer to do it in a macro.
Any ideas would be appreciated!!
Thanks!!
Troy -
WSStuartR
AskWoody LoungerSeptember 7, 2006 at 3:46 pm #1027601 -
WSTroyWells
AskWoody Lounger -
WSStuartR
AskWoody Lounger -
Andrew Lockton
AskWoody_MVPSeptember 10, 2006 at 2:01 am #1027982I don’t think you can use the same listtemplate to reset lists to restart at more than one number. I also can’t see a reason to actually do this either.
If you really need to set items in the list to specific numbers then I would expect that you have to either:
1. Create another listtemplate for that specific occurrance
2. Use Seq fields instead of lists to do your numbering. These can be reset to any number quite easily. -
WSTroyWells
AskWoody LoungerSeptember 10, 2006 at 10:16 am #1027997Andrew,
Thanks for your kind attention to my problem!!As far as why I need to reset numbering in the middle of a list, I have a single list template named “myListItems”. It is a multilevel list where the first two levels are “dummy” list items that are tied to specific styles that help numbering to restart at other levels.
Thus my problem. When the styles appear, say in an if/then table in the middle of a list, and the list continues, it starts over at 1. I have to put some of those dummy styles in the table so I can restart substeps in the second if/then row of the table. I can manually change it to start at whatever I want, but I’d prefer to do it in a macro.
Hey, I just had a thought. If I create a second list template and use the macro to apply that to the list items in these tables, will that list template interfere with numbering before and after the table if the numbering before and after the table use the other list template? If not, that may solve my problem. I could create a new “dummy” style to use in the if/then tables to reset numbering for the second and following if/then scenarios, and that dummy style should not restart items in my first list template since it will not appear in that template.
What do you think, or did I lose you?
Troy
-
Andrew Lockton
AskWoody_MVPSeptember 10, 2006 at 10:28 pm #1028042I’m not sure that I follow what you are trying to do so here is an example of my interpretation of your requirement.
1. Is there water in the kettle?
2. If No, fill the kettle with water
3. Turn on the Kettle
2. If Yes, turn on the kettle
4. When the kettle has boiled, turn it offIs that the type of logic/numbering you are trying to achieve? If not, I guess that I need to see an example document that demonstrates the logic and numbering you want to have.
A second list template might only be good for one alternate case and so you might need to keep adding listtemplates for each ‘funny’ list.I would recommend investigating either using SEQ fields or Cross-references rather than multiple listtemplates as I think you will get a more usable solution that way.
-
WSTroyWells
AskWoody LoungerSeptember 11, 2006 at 12:21 am #1028050OK. I can see that I would have to improve a lot to be clear as mud. Let me try.
I have 1 listtemplate, called “mylisttemplate”. It uses the following styles/formats:
Level 1 – paragraph style “style1” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 2 – paragraph style “style2” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 3 – paragraph style “style3” – Number format: “1.”
Level 4 – paragraph style “style4” – Number format: “a.”
Level 5 – paragraph style “style5” – Number format: “1)”No definitions beyond level 5 as I don’t use those in my lists.
My situation:
——————————-
1. List item 1.
2. List item 2.
(table that contains paragraph style “style1”. Because it contains style one, the next step restarts numbering at 1 instead of continuing a 3.Why does the table contain one of dummy styles, you might ask? Because the table contains two sets of substeps based on two alternative actions you could take in step 2. You could either take option 1 with sub-steps a. and b. or option 2 with sub-steps a. and b. I have to include paragraph style “style 1” to restart numbering within the table. Otherwise it would go: option 1 sub-steps a and b, then option 2 sub-steps c and d. Thus somewhere between option 1 and option two I put paragraph style “style 1” so the number restarts at the beginning of option 2. Unfortunately, this has the side effect of also restarting number in the list item immediately following the table. Thus…)
1. List item 3.
——————————-Thus, my proposed solution is to use a second list template for all numbering that appears within tables. It would be a similar mylist template, except that I would use different dummy styles at the first two levels to restart numbering. For example:
Level 1 – paragraph style “style6” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 2 – paragraph style “style7” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 3 – paragraph style “style8” – Number format: “a.”
Level 4 – paragraph style “style9” – Number format: “1)”These should restart numbering on items within the table that use paragraph style “style 8 or 9” but leave list items that use the first list template and paragraph style “style 3”, “style 4” or “style 5” unchanged.
At least that’s my theory. I’ll let you know how it turns out.
Enjoy!!
Troy -
Andrew Lockton
AskWoody_MVPSeptember 11, 2006 at 6:04 am #1028064OK, now I see what you are doing. I see nothing wrong with your logic but you may still do it through one list template (if you wished)
Level 1 – paragraph style “style1” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 2 – paragraph style “style2” – Number format: “1.”
Level 3 – paragraph style “style3” – Number format: “a.”
Level 4 – paragraph style “style4” – Number format: “1)”
Level 5 – paragraph style “style5” – Number format: “” (no number, just used to reset numbers on lower levels.)
Level 6 – paragraph style “style6” – Number format: “a.” (same look as Level 3 but used in table)
Level 7 – paragraph style “style7” – Number format: “1)” (same look as Level 3 but used in table)
-
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Xfinity home internet
by
MrJimPhelps
15 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
2 hours, 32 minutes ago -
Debian 12.11 released
by
Alex5723
7 hours, 15 minutes ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
10 hours, 57 minutes ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
8 hours, 26 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
7 hours, 25 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
1 day, 3 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
18 hours, 16 minutes ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 6 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
22 hours, 47 minutes ago -
Some advice for managing my wireless internet gateway
by
LHiggins
6 hours, 21 minutes ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
1 day ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
1 day, 16 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day, 12 hours ago -
Does windows update component store “self heal”?
by
Mike Cross
1 day, 2 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
2 days, 5 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
13 hours, 55 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
2 hours, 34 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
2 days, 8 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
2 days, 8 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 day, 21 hours ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
2 days, 16 hours ago -
0Patch, where to begin
by
cassel23
2 days, 10 hours ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
3 days, 6 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
2 days, 18 hours ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
3 days, 15 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
3 days, 5 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
8 hours, 10 minutes ago -
Installer program can’t read my registry
by
Peobody
4 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
3 days, 3 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.