command/macro to show Customize Outline Numbered List?

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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.

User avatar
HansV
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?

Post by HansV »

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
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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
Thanks! That works, although it feels a little different from ordinary macros.

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.

User avatar
HansV
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?

Post by HansV »

You'd have to ask someone in the Word VBA team...
Best wishes,
Hans

User avatar
HansV
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?

Post by HansV »

New Daddy wrote:That works, although it feels a little different from ordinary macros.
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:

Code: Select all

    strSendKeys = "%t"
    SendKeys strSendKeys
    With Dialogs(wdDialogFormatBulletsAndNumbering)
        .DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered
        .Show
    End With
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.
Best wishes,
Hans

User avatar
Jay Freedman
Microsoft MVP
Posts: 1316
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: command/macro to show Customize Outline Numbered List?

Post by Jay Freedman »

HansV wrote:You'd have to ask someone in the Word VBA team...
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.

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.

User avatar
HansV
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?

Post by HansV »

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... :sad:
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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... :sad:
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.

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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:
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.

User avatar
HansV
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?

Post by HansV »

New Daddy wrote:Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples?
Yes!
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

HansV wrote:
New Daddy wrote:Is that when the help file within Word had detailed information on every command in WordBasic along with helpful examples?
Yes!
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?

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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:
New Daddy wrote:That works, although it feels a little different from ordinary macros.
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:

Code: Select all

    strSendKeys = "%t"
    SendKeys strSendKeys
    With Dialogs(wdDialogFormatBulletsAndNumbering)
        .DefaultTab = wdDialogFormatBulletsAndNumberingTabOutlineNumbered
        .Show
    End With
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.

User avatar
HansV
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?

Post by HansV »

I'm sorry, I can't find a way to make it work.
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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.
How about this issue?

User avatar
HansV
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?

Post by HansV »

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;
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: command/macro to show Customize Outline Numbered List?

Post by New Daddy »

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;
Thanks! This thread has been very useful!

User avatar
Jay Freedman
Microsoft MVP
Posts: 1316
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: command/macro to show Customize Outline Numbered List?

Post by Jay Freedman »

New Daddy wrote:
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... :sad:
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.
For general reference...

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.

User avatar
HansV
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?

Post by HansV »

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?]
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... :sad:
Best wishes,
Hans