Solved

Convert to VB.NET

Posted on 2003-11-21
5
441 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
[X]
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
  • 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

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 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