Checking for a Blank Row

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitp
    New Member
    • Dec 2006
    • 49

    #1

    Checking for a Blank Row

    I've a word doc which contains a table with 3 rows and 6 columns of which one record is blank.I want to check for a blank row. How can i do that using VB 6.0. All suggessions are welcome.
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by amitp
    I've a word doc which contains a table with 3 rows and 6 columns of which one record is blank.I want to check for a blank row. How can i do that using VB 6.0. All suggessions are welcome.
    dear whenevr ur reading any line try to use len(trim(<strin g>))=0 will give u blank
    or trim(string)=vb nullstring do d same

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      Hi. You will need to learn Ole Automation. Include ms word as a reference in your project and use word objects to access the table.

      Comment

      • amitp
        New Member
        • Dec 2006
        • 49

        #4
        The thing is that i want to check if there is any text in the cell for a particular row. How i can check whether all the cells of the row are blank or not. I'm using the below code for checking:

        Code:
        dim lsColVal  as variant
        
        For liS = 1 To wrdFinApp.ActiveDocument.Tables(1).Rows(2).Cells.Count
                 lsColVal = wrdFinApp.ActiveDocument.Tables(1).Cell(2, liS)
                 If (Len(Trim$(lsColVal)) <> 0) Then
                          lbCheck = False
                          Exit For
                  End If
        Next liS
        if any cell is blank it retuns two square boxes and when any text exists it returns more than 2 square boxes but not the text. So i get confused to check for the blank cell.
        Last edited by willakawill; Mar 7 '07, 05:38 AM. Reason: please use code tags when posting code

        Comment

        • amitp
          New Member
          • Dec 2006
          • 49

          #5
          Anybody having any idea to my question share with me.

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by amitp
            The thing is that i want to check if there is any text in the cell for a particular row. How i can check whether all the cells of the row are blank or not. I'm using the below code for checking:

            Code:
            dim lsColVal  as variant
            
            For liS = 1 To wrdFinApp.ActiveDocument.Tables(1).Rows(2).Cells.Count
                     lsColVal = wrdFinApp.ActiveDocument.Tables(1).Cell(2, liS)
                     If (Len(Trim$(lsColVal)) <> 0) Then
                              lbCheck = False
                              Exit For
                      End If
            Next liS
            if any cell is blank it retuns two square boxes and when any text exists it returns more than 2 square boxes but not the text. So i get confused to check for the blank cell.
            What is the problem with this code? I didn't understnd the bit about it returning "2 square boxes".

            Comment

            Working...