View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ruth Ruth is offline
external usenet poster
 
Posts: 132
Default String vs LONG format

Thanks for your answer. In case I didn't explain it clear before I will try
to reformulate the problem...

- Cells T1...500 in EXCEL contains a paragraph of text of whatever lenght
(it is not known beforehand!) that has to be copied in a form in word.

- The field Text3 is the field in the WORD form where I want to copy the
text from the previous cell (there is one field for each cell).

Depending on the length of the content of the text in the cells T1...500,
the follwowing routine works or not ...

If wdFF.Name = "Text3" Then
wdFF.Result = Range("T" & fila)
End If


If the text in the EXCEL cell is long enough, the previous routine fails in
execution because wdFF.Result is expecting to see a String and seems the text
in the cell is too long for a string.
Any idea of how to avoid this problem?


"Nigel" wrote:

The result of the evaluation of Range("T" & fila) presumably returns a
string? What do you mean when you say "the info received is much longer",
a string is a string! Long vars refer to a numerical value not a string.

You could convert the value to a string using Cstr(Range("T" & fila)) but
you probably need some error checking to avoid error values, nulls etc.



--

Regards,
Nigel




"Ruth" wrote in message
...
Hey guys,

Any idea about how to solve this?

I want to copy some cells in EXCEL to a form in WORD. The problem is when
the cells in EXCEL contain some long paragraphs of text. I have done it in
the following
way:

If wdFF.Name = "Text3" Then
wdFF.Result = Range("T" & fila)
End If

Text3 is the field in the form where the info should be inserted. If I
copy
and paste manually the info to the field in the form it works fine but
with
the code above it does not work because it seems the object wdFF is
expecting
to see only a string and the info received is much longer. Is there any
way
to modify the format of the object wdFF from string to long?? or should I
cut
and put together later on?

Thanks!!