Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2023, 10:54 AM
nonno nonno is offline Turn text outline into autonumbered multilevel outline Windows 10 Turn text outline into autonumbered multilevel outline Office 2016
Novice
Turn text outline into autonumbered multilevel outline
 
Join Date: Mar 2023
Posts: 5
nonno is on a distinguished road
Default Turn text outline into autonumbered multilevel outline

I found an outline on-line, but when I paste it into Word, there isn't an auto numbered outline. I'm basically just left with raw text.



The outline is A., 1., a., i.

I found this macro which does apply the Heading styles (1-5), however, how do I now run thru the document to apply those newly create headings? I tried the additional macro that is supposed to do it, but it's not working on the doc.

Here is the document I'm working with

Code:
Sub ApplyMultiLevelHeadingNumbers()
Dim LT As ListTemplate, i As Long
Set LT = ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
For i = 1 To 5
  With LT.ListLevels(i)
    .NumberFormat = Choose(i, "%1.", "%2.", "%3.", "%4.", "%5.")
    .TrailingCharacter = wdTrailingTab
    .NumberStyle = Choose(i, wdListNumberStyleUppercaseLetter, wdListNumberStyleArabic, wdListNumberStyleLowercaseLetter, wdListNumberStyleLowercaseRoman, wdListNumberStyleUppercaseLetter)
    .NumberPosition = 0
    .Alignment = wdListLevelAlignLeft
    .TextPosition = CentimetersToPoints(0.5 + i * 0.5)
    .ResetOnHigher = True
    .StartAt = 1
    .LinkedStyle = "Heading " & i
  End With
Next
End Sub
Attached Files
File Type: docx Test.docx (38.5 KB, 4 views)
Reply With Quote
  #2  
Old 03-24-2023, 11:17 AM
Charles Kenyon Charles Kenyon is offline Turn text outline into autonumbered multilevel outline Windows 11 Turn text outline into autonumbered multilevel outline Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Just a note that I moved your post to the vba forum.
Reply With Quote
  #3  
Old 03-25-2023, 02:37 PM
Guessed's Avatar
Guessed Guessed is offline Turn text outline into autonumbered multilevel outline Windows 10 Turn text outline into autonumbered multilevel outline Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This is a job for the autoformat command but if you wanted the same thing via a macro it might look like this
Code:
Sub Macro2()
  Selection.Document.Kind = wdDocumentNotSpecified
  Selection.Range.AutoFormat
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 03-25-2023, 03:22 PM
nonno nonno is offline Turn text outline into autonumbered multilevel outline Windows 10 Turn text outline into autonumbered multilevel outline Office 2016
Novice
Turn text outline into autonumbered multilevel outline
 
Join Date: Mar 2023
Posts: 5
nonno is on a distinguished road
Default

Thanks Andrew. This seems to work great to indent each paragraph according to the ident level, but nothing is connected as in the auto numbered multi-level list. So, if I was to delete say one of the lower-case roman numeral paragraphs, it does not auto number.
Reply With Quote
  #5  
Old 03-27-2023, 10:20 PM
Guessed's Avatar
Guessed Guessed is offline Turn text outline into autonumbered multilevel outline Windows 10 Turn text outline into autonumbered multilevel outline Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

That earlier code applies styles so the hardest part is done.

You can then assign the numbering to List series of styles applied by the macro or by importing the correct style definitions from a template.

Alternatively, you could run a series of find/replaces to assign your preferred (autonumbered) styles.

Does your sample document already contain an autonumbered list outline that can be applied to the List styles?

And you can remove the manual numbers with a macro like this that works on selected paragraphs
Code:
Sub NumberingDeleteHardcoded()
  'Only acts on selected paragraphs
  Dim iResp As Integer
  iResp = MsgBox("This macro will remove all hardcoded paragraph numbers " _
    & vbCr & "from the SELECTED paragraphs. Click OK to continue.", _
    vbOKCancel, "Delete Hard Numbers")
  If iResp = vbOK Then
    WordBasic.ToolsBulletsNumbers Replace:=0, Type:=1, Remove:=1
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old 03-28-2023, 03:23 PM
nonno nonno is offline Turn text outline into autonumbered multilevel outline Windows 10 Turn text outline into autonumbered multilevel outline Office 2016
Novice
Turn text outline into autonumbered multilevel outline
 
Join Date: Mar 2023
Posts: 5
nonno is on a distinguished road
Default

Thanks Andrew.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turn text outline into autonumbered multilevel outline convert multilevel list to a true outline markjkubicki Word 3 10-17-2018 10:12 AM
Printing an Outline formatted document that displays the outline mikecox Word 2 09-01-2018 03:57 PM
Turn text outline into autonumbered multilevel outline How do i get rid an outline box on all text Neumans2000 Word 2 09-14-2015 05:56 AM
Macro to Expand Outline Heading in Outline View? Clueless in Seattle Word VBA 1 05-04-2015 05:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft