Home > Enterprise >  vb.net get cell value from word file table
vb.net get cell value from word file table

Time:06-01

I have some code to get cell value from a word file table.

But it contains something like 口 and will generate a line which is useless, how can I remove this character?

Dim num As String = Trim$(wordApp.ActiveDocument.Tables.Item(1).Cell(6,1).Range.Text)
    MsgBox(num)

output is this.

But I'm sure the original cell value doesn't have a empty line.

CodePudding user response:

For example (with VBA):

String = Split(wordApp.ActiveDocument.Tables.Item(1).Cell(6,1).Range.Text, vbCr)(0)

The ¤ is Word's end-of-cell marker, which you need to exclude.

  • Related