Solved

Convert to VB.NET

Posted on 2003-11-21
5
433 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
Comment Utility
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
Comment Utility
This will leave the rest of the paragrpah untouched????

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

Author Comment

by:scorpion53061
Comment Utility
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
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now