command/macro to show Customize Outline Numbered List?
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
command/macro to show Customize Outline Numbered List?
Does anybody know the Word command or macro to bring up the Customize Outline Numbered List dialog box?
I can't find the corresponding Word command and have no idea how to do it in a macro.
I use outline numbered list so often that being able to go directly to the customization will save me a lot of time.
I can't find the corresponding Word command and have no idea how to do it in a macro.
I use outline numbered list so often that being able to go directly to the customization will save me a lot of time.
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
There is no built-in command for this.
The following macro will hopefully show the dialog if the insertion point is in or below an outline numbered paragraph.
Warning: do NOT run this macro from the Visual Basic Editor, only run it from within Word itself.
The macro is originally from Klaus Linke.
The following macro will hopefully show the dialog if the insertion point is in or below an outline numbered paragraph.
Warning: do NOT run this macro from the Visual Basic Editor, only run it from within Word itself.
The macro is originally from Klaus Linke.
Code: Select all
Sub ShowDialog()
Dim rngOld As Range
Dim myLT As ListTemplate
Dim nameStyle As String
Dim i As Integer, iOldListLevel As Integer
Dim strSendKeys As String
Set rngOld = Selection.Range.Duplicate
Selection.Collapse (wdCollapseStart)
' Move up while para is no list para:
Do While Selection.Paragraphs(1).Range.ListParagraphs.Count <> 1
Selection.Move Unit:=wdParagraph, Count:=-1
If Selection.Start = 0 Then
rngOld.Select
Exit Sub
End If
Loop
nameStyle = Selection.Paragraphs(1).Range.ListFormat.ListTemplate.ListLevels(1).LinkedStyle
iOldListLevel = Selection.Paragraphs(1).Range.ListFormat.ListLevelNumber
' Move up to the next para using that style:
Do While Selection.Paragraphs(1).Style.NameLocal <> nameStyle
Selection.Move Unit:=wdParagraph, Count:=-1
' Exit sub if start of document is reached:
If Selection.Start = 0 Then
rngOld.Select
Exit Sub
End If
Loop
Application.EnableCancelKey = wdCancelDisabled
strSendKeys = "%t"
SendKeys strSendKeys
With Dialogs(wdDialogFormatBulletsAndNumbering)
.DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered
.Show
End With
'rngOld.Select
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
Thanks! That works, although it feels a little different from ordinary macros.HansV wrote:There is no built-in command for this.
The following macro will hopefully show the dialog if the insertion point is in or below an outline numbered paragraph.
Warning: do NOT run this macro from the Visual Basic Editor, only run it from within Word itself.
The macro is originally from Klaus Linke.
Code: Select all
Sub ShowDialog() Dim rngOld As Range Dim myLT As ListTemplate Dim nameStyle As String Dim i As Integer, iOldListLevel As Integer Dim strSendKeys As String Set rngOld = Selection.Range.Duplicate Selection.Collapse (wdCollapseStart) ' Move up while para is no list para: Do While Selection.Paragraphs(1).Range.ListParagraphs.Count <> 1 Selection.Move Unit:=wdParagraph, Count:=-1 If Selection.Start = 0 Then rngOld.Select Exit Sub End If Loop nameStyle = Selection.Paragraphs(1).Range.ListFormat.ListTemplate.ListLevels(1).LinkedStyle iOldListLevel = Selection.Paragraphs(1).Range.ListFormat.ListLevelNumber ' Move up to the next para using that style: Do While Selection.Paragraphs(1).Style.NameLocal <> nameStyle Selection.Move Unit:=wdParagraph, Count:=-1 ' Exit sub if start of document is reached: If Selection.Start = 0 Then rngOld.Select Exit Sub End If Loop Application.EnableCancelKey = wdCancelDisabled strSendKeys = "%t" SendKeys strSendKeys With Dialogs(wdDialogFormatBulletsAndNumbering) .DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered .Show End With 'rngOld.Select End Sub
I'm puzzled that not every dialog box has a corresponding Word command or VBA command. I wonder why Microsoft decided not to support some features in Word command or VBA.
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
You'd have to ask someone in the Word VBA team...
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
Most of the code is to ensure that the insertion point is in a level 1 paragraph, since customizing an outline-numbered list should always be done from the top (level 1) down.New Daddy wrote:That works, although it feels a little different from ordinary macros.
The actual code to display the dialog is relatively short:
Code: Select all
strSendKeys = "%t"
SendKeys strSendKeys
With Dialogs(wdDialogFormatBulletsAndNumbering)
.DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered
.Show
End With
Best wishes,
Hans
Hans
-
- Microsoft MVP
- Posts: 1316
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: command/macro to show Customize Outline Numbered List?
The Word, Excel, PowerPoint, and Office System MVPs who attend the Summit in Redmond -- among which I'm lucky to have been repeatedly -- always ask for full VBA support of all the built-in dialogs and full documentation of what's available. The response is always the standard "That's excellent feedback." Pardon me if I'm not overwhelmed by the practical results.HansV wrote:You'd have to ask someone in the Word VBA team...
I understand, though, that there are a lot of factors that go into deciding what to include in each version, and that making life easier for the relatively few people who write complex macros would be difficult to justify as a business case.
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
The documentation for WordBasic was very thorough and complete, and that for the first version of Word VBA was still quite good. It seems to have gone downhill from there...
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples? I remember having relied on Word's own help file to write macros, and often there was enough information. Nowadays, I can't find anything in Word and have wondered where it has all gone. Microsoft must have removed them then.HansV wrote:The documentation for WordBasic was very thorough and complete, and that for the first version of Word VBA was still quite good. It seems to have gone downhill from there...
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
Ok, now I'm branching off to a tangential topic, but why do you have to be at level 1 paragraph before modifying the outline numbered list? I don't make it a rule to do so, and maybe that's why I'm having so much trouble with my outline numbered list, even after mapping them with Heading styles.HansV wrote: Most of the code is to ensure that the insertion point is in a level 1 paragraph, since customizing an outline-numbered list should always be done from the top (level 1) down.
The actual code to display the dialog is relatively short:
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
Yes!New Daddy wrote:Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
Do you think anyone was diligent enough to download the entire WordBasic help and stashed it somewhere? Or is VBA so different from WordBasic that it won't be of help?HansV wrote:Yes!New Daddy wrote:Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples?
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
One problem with this macro. I works as it is supposed to from the Macro command. But when it's mapped on a keyboard shortcut, it's stuck at the Bullets and Numbering dialog box, as if "%t" is not sent to Word. Maybe it's because it's getting confused with %t and the short-cut that's assigned to this macro. Any idea why and how to solve it?
HansV wrote:Most of the code is to ensure that the insertion point is in a level 1 paragraph, since customizing an outline-numbered list should always be done from the top (level 1) down.New Daddy wrote:That works, although it feels a little different from ordinary macros.
The actual code to display the dialog is relatively short:
This code opens the Format | Bullets and Numbering dialog, activated the Outline Numbered tab, and sends the keystroke Alt+t to it - the 'accelerator' for the Customize... button.Code: Select all
strSendKeys = "%t" SendKeys strSendKeys With Dialogs(wdDialogFormatBulletsAndNumbering) .DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered .Show End With
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
I'm sorry, I can't find a way to make it work.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
How about this issue?New Daddy wrote:Ok, now I'm branching off to a tangential topic, but why do you have to be at level 1 paragraph before modifying the outline numbered list? I don't make it a rule to do so, and maybe that's why I'm having so much trouble with my outline numbered list, even after mapping them with Heading styles.
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
Each lower level depends on the one above it, so it's best to start editing at the top and work your way down.
See http://shaunakelly.com/word/numbering/n ... g2003.html" onclick="window.open(this.href);return false;
See http://shaunakelly.com/word/numbering/n ... g2003.html" onclick="window.open(this.href);return false;
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 437
- Joined: 05 Nov 2012, 20:02
Re: command/macro to show Customize Outline Numbered List?
Thanks! This thread has been very useful!HansV wrote:Each lower level depends on the one above it, so it's best to start editing at the top and work your way down.
See http://shaunakelly.com/word/numbering/n ... g2003.html" onclick="window.open(this.href);return false;
-
- Microsoft MVP
- Posts: 1316
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: command/macro to show Customize Outline Numbered List?
For general reference...New Daddy wrote:Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples? I remember having relied on Word's own help file to write macros, and often there was enough information. Nowadays, I can't find anything in Word and have wondered where it has all gone. Microsoft must have removed them then.HansV wrote:The documentation for WordBasic was very thorough and complete, and that for the first version of Word VBA was still quite good. It seems to have gone downhill from there...
The article Useful WordBasic commands that have no VBA equivalent describes some methods of the WordBasic object in VBA that do things that would otherwise be fairly painful to program. As a bonus, the last paragraph contains a link to download the old WordBasic help file, which can still be useful for some things.
For anyone writing VBA macros in Office 2013, the VBA help is only online. MS still hasn't figured out that some people try to do useful work when they don't have an Internet connection. As penance, we (MVPs) extracted a promise to make the VBA help files available for download as offline, standalone files. You can download them from http://www.microsoft.com/en-us/download ... x?id=40326. [If you're outside the US, does this URL automatically redirect to your local version?] We've been told that the online help may be updated at intervals but the offline files won't be updated; YMMV.
-
- Administrator
- Posts: 78417
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: command/macro to show Customize Outline Numbered List?
When I follow the link from The Netherlands, I still get the US English version; if I manually change en-us to any other language, I get "We are sorry, the page you requested cannot be found.", so apparently only the English help files have been made available for download...Jay Freedman wrote:You can download them from http://www.microsoft.com/en-us/download ... x?id=40326. [If you're outside the US, does this URL automatically redirect to your local version?]
Best wishes,
Hans
Hans