wrdApp.Selection() question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Asprisa
    New Member
    • Oct 2007
    • 30

    wrdApp.Selection() question

    Hi Guys,

    Hopefully this is a quick one, i am currently building an application that mail merge's data to Microsoft Word, when the text is sent across it has line spacing all i want to do is set it to no spacing, i have looked at:

    wrdSelection.Pa ragraphs.Format .space1
    wrdSelection.Pa ragraphs.Format .space15
    wrdSelection.Pa ragraphs.Format .space2

    i cannot seem to find either a "no line space" or "space0" for instance, can any one help me out?

    Regards

    Jay!
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Please provide more info re your application. Thanks.

    Comment

    • Asprisa
      New Member
      • Oct 2007
      • 30

      #3
      Hi There,

      I have extracted this code as an example to show you, basically it opens a word doc, and writes text and images onto the document, but when it does it, there is automatically a line seperating two lines of text, so i wondered if there was a way of setting the paragraph to 'no spacing' .

      Code:
       Dim wrdApp As Word.Application
          Dim wrdDoc As Word._Document
      
       ' Create an instance of Word  and make it visible.
              wrdApp = CreateObject("Word.Application")
              wrdApp.Visible = True
              ' Add a new document.
              wrdDoc = wrdApp.Documents.Add()
              wrdDoc.Select()
              wrdSelection = wrdApp.Selection()
      
              wrdSelection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
      
      InsertLines(1) ' creates a space between blocks of text
      
              wrdSelection.Font.Name = "Arial"
              wrdSelection.Font.Bold = True
              wrdSelection.Font.Size = 9
              wrdSelection.TypeText("Total Excl VAT @" & vatratetxt.Text)
              wrdSelection.Font.Bold = False
              wrdSelection.TypeText(" ")
              wrdSelection.TypeText("      " & vatexcl.ToString("c") & vbCr)
      
              wrdSelection.Font.Name = "Arial"
              wrdSelection.Font.Bold = True
              wrdSelection.Font.Size = 9
              wrdSelection.TypeText("Total VAT         @" & vatratetxt.Text)
              wrdSelection.Font.Bold = False
              wrdSelection.TypeText(" ")
      
              wrdSelection.TypeText("      " & vat.ToString("c") & vbCr)
      
              wrdSelection.Font.Name = "Arial"
              wrdSelection.Font.Bold = True
              wrdSelection.Font.Size = 9
              wrdSelection.TypeText("Total Incl VAT  @" & vatratetxt.Text)
              wrdSelection.Font.Bold = False
              wrdSelection.TypeText(" ")
              wrdSelection.TypeText("      " & vatincl.ToString("c") & vbCr)
      Any help is much appriciated!

      Jay!

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        Have you tried ParagraphFormat .LineSpacingRul e and giving it a value? Never used it myself...

        Comment

        Working...