A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how to export cell value outside word



 
 
Thread Tools Display Modes
  #1  
Old September 16th, 2007, 01:05 AM posted to microsoft.public.word.tables
[email protected]
external usenet poster
 
Posts: 2
Default 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  
Old September 16th, 2007, 01:40 AM posted to microsoft.public.word.tables
Jay Freedman
external usenet poster
 
Posts: 9,488
Default 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  
Old September 16th, 2007, 09:54 PM posted to microsoft.public.word.tables
[email protected]
external usenet poster
 
Posts: 2
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.