Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Convert to VB.NET

Posted on 2003-11-21
5
438 Views
Last Modified: 2008-03-17
I need to convert this vba code to vb.net. After the first line of the paragraph it is suppose to indent the following lines 5 clicks. It is working except that the entire paragraph is getting moved those 5 clicks. This code works inside a macro in MS Word......

Please help..........

With oDoc.Content.Application.Selection.ParagraphFormat
                .LeftIndent = oDoc.Content.Application.InchesToPoints(0.5)
                .RightIndent = oDoc.Content.Application.InchesToPoints(0)
                .SpaceBefore = 0
                .SpaceBeforeAuto = False
                .SpaceAfter = 0
                .SpaceAfterAuto = False
                .LineSpacingRule = oDoc.Content.Application.Selection.ParagraphFormat.LineSpacingRule.wdLineSpaceDouble
                .Alignment = CInt(Word.WdParagraphAlignment.wdAlignParagraphLeft)
                .WidowControl = True
                .KeepWithNext = False
                .KeepTogether = False
                .PageBreakBefore = False
                .NoLineNumber = False
                .Hyphenation = True
                .FirstLineIndent = oDoc.Content.Application.InchesToPoints(0.05)
                .OutlineLevel = 10 'oDoc.Content.Application.Selection.ParagraphFormat.OutlineLevel = 10 'CInt(Word.WdOutlineLevel.wdOutlineLevelBodyText = 0)
                .CharacterUnitLeftIndent = 0
                .CharacterUnitRightIndent = 0
                .CharacterUnitFirstLineIndent = 0
                .LineUnitBefore = 0
                .LineUnitAfter = 0
            End With
0
Comment
Question by:scorpion53061
  • 3
  • 2
5 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 9799292
I read it that you need a hanging indent:

With oDoc.Content.Application.Selection.ParagraphFormat
        .LeftIndent = InchesToPoints(0.5)
        .FirstLineIndent = InchesToPoints(-0.5)
End With

This gives you a hanging indent of .5 inches.
0
 

Author Comment

by:scorpion53061
ID: 9799389
This will leave the rest of the paragrpah untouched????

If so you may have my first born...... :)
0
 

Author Comment

by:scorpion53061
ID: 9799434
Thank you very much..........

If you could point me to an internet resource or other source that helped you learn that stuff I will be greatful........
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9799541
You know what I find to be most helpful with learning automation is to record actions using the Macro recorder in Word, and going from there.  I usually find that it records a lot more stuff than I need, but at least it is a place to start.  I think it would be difficult to find just the right web site for that all-encompassing source.  I have just culled my knowledge from many years of struggling and practicing and searching and struggling and succeeding and failing and struggling...Ya know!

I still don't find it very easy to automate Office after all these years!
0
 

Author Comment

by:scorpion53061
ID: 9810393
Hi,

Could I have your email address? I really would like to pick your brain about some things.

send to admin@jjkoepsell.com

IN addition, do you know how to automate that your page number would read for instance

"Martens 1"
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question