Solved

Convert to VB.NET

Posted on 2003-11-21
5
436 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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