[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

heading style with messed identation

I don't know how, but Word 2003 (SP2 for office 2003 installed) added to my heading style a configruation that I never requested: identation 57 cm (?!)...

The result is that a very long title doesn't wrap. I copied an heading from the document I'm working on in a new word document (ident57sucks.doc) so that you can see it and tell me what to do in order to get rid of that stupid identation.

See "Format" > Paragraph: see indentation 57 cm... If I insert 0 I get this warning "The measurement must be betweeen -55.87 and 55.87 cm"... watf? Isnt' "0" between -55 and 55?? Word is stupid, isn't it? But here should be a workaround, I don't have time to rewrite my document from scratch because of this.

I had the same problem with heading 1 but a friend told me to copy it to a new document and copy it back... I did something like that and somehow it worked, but I can't make it work again for this one...

500 points to solve this. Please tell me what menu to click step by step in order to correct this, or alternatively save the word file corrected and give me the link. In case you give me a corrected file I consider this issue solved if I can copy the title in my working document and get the style corrected there.

Here the word document: http://www.pbworks.net/download/ident57sucks.doc
0
firepol
Asked:
firepol
1 Solution
 
gbahriCommented:
Below code will help in over-riding the earlier values of Paragraph Formatting. This is probably due to the language you are using on Word. Here, Paragraph formatting unit changes to "character width" rather than pts, cm, etc. You can modify the values of .CharacterUnitLeftIndent, ChracterUnitFirstLineIndent as per your needs.
====================================================
Sub Heading4Style()
    With ActiveDocument.Styles("Heading 4")
        .AutomaticallyUpdate = True
        .BaseStyle = "Normal"
        .NextParagraphStyle = "Normal"
        .ParagraphFormat.LeftIndent = 0
        .ParagraphFormat.CharacterUnitLeftIndent = 0 ' sets a first-line indent of one character for the first paragraph in the active document
        .ParagraphFormat.CharacterUnitFirstLineIndent = -1.5  ' sets a hanging indent of 1.5 characters for the second paragraph in the active document
    End With
Dim myPara As Paragraph

For Each myPara In ActiveDocument.Paragraphs

If myPara.Range.Style = "Heading 4" Then

    Selection.Style = "Heading 4"
End If

set myPara = nothing
Next

===========================================

Thanks,

GBahri
0
 
GrahamSkanCommented:
The problem appears to be that there is a check on the value before it is changed.
You can fix it with a line of VB code:

Selection.Paragraphs.FirstLineIndent = CentimetersToPoints(1)

To run it, put the cursor in the paragraph.
Open the VBA editor with Alt+F11.
Open the Immediate Window with Ctrl+G.
Paste the code into the Immediate Window and hit Enter.

The paragrah indent should now be within bounds.
0
 
firepolAuthor Commented:
GrahamSkan: your instructions were clear, I did exactly as you told me. After adding your line in VB I could modify the identation to "0" and now the title is wrappin as I wanted. Thanks a LOT.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

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