none
Need Help : Getting Rid of a Line displayed on each paragraph RRS feed

  • Question

  • Hi,

    I am automating word 2003 so that i can generate a word document using vba coding. The code generates a word document and populates several paragraphs and tables in the word document. The code is working fine and it generates the document as expected. The only thing i am facing as a problem is i am getting a line inbetween each paragraphs. The output of my code is as follows.

     

    The code i am using is as follows:

    '-------------- Start of Section 3 Heading Section
    '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      
      Set oPara20 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks("\EndofDoc").Range)
      oPara20.Range.Select
      oDoc.ActiveWindow.Selection.ClearFormatting
      oPara20.Range.Paragraphs(1).Alignment = wdAlignParagraphLeft
      oPara20.Range.Font.Bold = True
      oPara20.Range.Font.Name = "Arial"
      oPara20.Range.Font.Size = 10
      oPara20.Range.Text = "Section 3 Paragraph"
      oPara20.Borders(wdBorderBottom).Visible = True
      oPara20.Borders(wdBorderBottom).Color = wdColorBlack
      oPara20.Format.SpaceAfter = 4
      oPara20.Range.InsertParagraphAfter
      oPara20.Range.InsertBreak Type:=wdSectionBreakContinuous
        
    '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    '-------------- Start of Details Table Section
    '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        
      Set oTable = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, 2, 2, wdWord9TableBehavior)
      oTable.Select
      oDoc.ActiveWindow.Selection.ClearFormatting
      
      oTable.PreferredWidthType = wdPreferredWidthPercent
      oTable.PreferredWidth = 99.2
      oTable.Rows.HeightRule = wdRowHeightAtLeast
      oTable.Rows.Height = CentimetersToPoints(0.5)
      oTable.Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
      
      With oDoc.ActiveWindow.Selection
        .Borders(wdBorderBottom).Visible = False
        .Borders(wdBorderLeft).Visible = False
        .Borders(wdBorderRight).Visible = False
        .Borders(wdBorderTop).Visible = False
        .Borders(wdBorderVertical).Visible = False
      End With
      
      oTable.Range.Font.Size = 9
      oTable.Range.Font.Name = "Arial"
      oTable.Range.Font.Bold = False
      
      For r = 1 To 2
        oTable.Range.Columns(1).PreferredWidthType = wdPreferredWidthPercent
        oTable.Range.Columns(1).PreferredWidth = 85
        oTable.Rows.Alignment = wdAlignRowLeft
      Next
        oTable.Cell(1, 1).Range.Text = "Total Number of members"
        oTable.Cell(1, 1).Borders(wdBorderBottom).Visible = False
        oTable.Cell(1, 2).Borders(wdBorderBottom).Visible = True
        oTable.Cell(2, 1).Range.Text = "Total Number of members joined after the date"
        oTable.Cell(2, 2).Borders(wdBorderBottom).Visible = True
        
      oPara20.Range.InsertParagraphAfter
      oPara20.Range.InsertBreak Type:=wdSectionBreakContinuous
      
    '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    '-------------- Start of Category Table Section
    '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      
      Set oTable = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, 4, 2, wdWord9TableBehavior)
      oTable.Select
      oDoc.ActiveWindow.Selection.ClearFormatting
      
      oTable.PreferredWidthType = wdPreferredWidthPercent
      oTable.PreferredWidth = 50
      oTable.Columns(1).AutoFit '.PreferredWidth = 30
      oTable.Columns(2).AutoFit 'PreferredWidth = 70
      oTable.Rows.HeightRule = wdRowHeightAtLeast
      oTable.Rows.Height = CentimetersToPoints(0.5)
      oTable.Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
      oTable.Rows(1).Shading.BackgroundPatternColor = wdColorGray15
    
        With oTable
          .Cell(1, 1).Range.Text = "Category"
          .Cell(1, 1).Range.Font.Bold = True
          .Cell(1, 2).Range.Text = "Total CCT per Category"
          .Cell(1, 2).Range.Font.Bold = True
        End With
      
      oPara20.Range.InsertBreak Type:=wdSectionBreakContinuous
      oPara20.Range.Text = vbCrLf
    

    Can anyone help me by modifying or changing my code to get rid of that line?

    Any help regarding this is highly appreciated.

    Regards,

    Karthik Venkatraman

     


    Thanks you and Kind Regards, Karthik Venkatraman
    Thursday, August 25, 2011 9:37 AM

Answers

All replies