Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1954
  • Last Modified:

Error 5552 "The selection does not consist of heading levels"

Hi,

I copied the below codes and tried to run on my word document, but I receive the error "The selection does not consist of heading levels"

Below are the codes. Can someone tell me exactly what's wrong, and what do i need to do? I tried searching for this error in microsoft's web, but can't find anything....

Sub AllSectionsToSubDoc(ByRef doc As Word.Document)
Dim secCounter As Long
Dim NrSecs As Long
NrSecs = doc.Sections.Count
'Start from the end because creating
'Subdocs inserts additional sections
For secCounter = NrSecs - 1 To 1 Step -1
doc.Subdocuments.AddFromRange _
  doc.Sections(secCounter).Range
Next secCounter
0
sata
Asked:
sata
1 Solution
 
GrahamSkanCommented:
The first paragraph of a subdocument should be a heading level.
In outline mode, promote the first paragraph from body text to a heading (left arrow on the outline toolbar)
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
To supplement what Graham has said - click on the first paragraph or first line and press Alt Control 1.

That will apply Heading 1


0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now