Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA for Word recognizes zeros in table rows as Null 1

Status
Not open for further replies.

VBAword

Technical User
Jun 11, 2003
3
US
When I am cycling through the cells in a table the variable in the code below (sNodeValue) doesn't pick up anything when there is a zero in the table cell in MS Word. The variable is declared as String. Numbers and letters are recognized fine, but zeros shows up as "".

sNodeValue = rngTable.Cell(iRow, iColumn).Range.Text
 
Hi,

I got "0" with this code...
Code:
    For Each c In ActiveDocument.Tables(1).Range.Cells
        With c.Range
            sNodeValue = Left(.Text, Len(.Text) - 2)
        End With
    Next
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
That works, I get zero, but how do I fit

Left(.Text, Len(.Text) - 2)

into

sNodeValue = rngTable.Cell(iRow, iColumn).Range.Text

would it be something like

sNodeValue = rngTable.Cell(Left(.Text, Len(.Text) - 2))

??
 
Skip you are the BEST !!! Thank You very much! I was amazed yesterday with your extemely fast and accurate reply. I'm sorry it took 24 hours for me to reply but I had to tweak a couple of things and then throughly test it this morning and viola! I works great. Thanks for solving this vexing problem that has created lots of other problems for us.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top