If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
how to export cell value outside word
Hi, I have to export the value of a cell outside word (to database)
but I didn't find anything that can help me. I found a lot of command but none works. For example: ActiveDocument.Tables(1).Cell(2, 1).Range.Text to retrieve the cell content, give me the right result but there is one or more squares characters (it depends on cell value) added to the number to export. This couse an incompatibility with the field of database. Why there is those hidden characters and how can I remove them? There is a faster way to do this? Thank you |
#2
|
|||
|
|||
how to export cell value outside word
The two extra characters at the end of the string are the cell marker
(which appears as the single character ¤ when you display nonprinting characters). Every cell contains at least the cell marker, even when it appears to be empty. You can get the string you want with this code: st = ActiveDocument.Tables(1).Cell(2, 1).Range.Text st = Left(st, Len(st) - 2) or with this code: Dim rg As Range, st As String Set rg = ActiveDocument.Tables(1).Cell(2, 1).Range rg.MoveEnd wdCharacter, -1 st = rg.Text -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. On Sat, 15 Sep 2007 17:05:59 -0700, wrote: Hi, I have to export the value of a cell outside word (to database) but I didn't find anything that can help me. I found a lot of command but none works. For example: ActiveDocument.Tables(1).Cell(2, 1).Range.Text to retrieve the cell content, give me the right result but there is one or more squares characters (it depends on cell value) added to the number to export. This couse an incompatibility with the field of database. Why there is those hidden characters and how can I remove them? There is a faster way to do this? Thank you |
#3
|
|||
|
|||
how to export cell value outside word
Thank you very much! I successfully exported my data. Thanks again.
On 16 Set, 02:40, Jay Freedman wrote: The two extra characters at the end of the string are the cell marker (which appears as the single character ¤ when you display nonprinting characters). Every cell contains at least the cell marker, even when it appears to be empty. You can get the string you want with this code: st = ActiveDocument.Tables(1).Cell(2, 1).Range.Text st = Left(st, Len(st) - 2) or with this code: Dim rg As Range, st As String Set rg = ActiveDocument.Tables(1).Cell(2, 1).Range rg.MoveEnd wdCharacter, -1 st = rg.Text -- Regards, Jay Freedman Microsoft Word MVP FAQ:http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. On Sat, 15 Sep 2007 17:05:59 -0700, wrote: Hi, I have to export the value of a cell outside word (to database) but I didn't find anything that can help me. I found a lot of command but none works. For example: ActiveDocument.Tables(1).Cell(2, 1).Range.Text to retrieve the cell content, give me the right result but there is one or more squares characters (it depends on cell value) added to the number to export. This couse an incompatibility with the field of database. Why there is those hidden characters and how can I remove them? There is a faster way to do this? Thank you |
Thread Tools | |
Display Modes | |
|
|