View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Andrew Taylor Andrew Taylor is offline
external usenet poster
 
Posts: 225
Default String vs LONG format

You say "rngx is defined as a range" - does this mean
you have "Dim rngx as Range" in your Excel code?
That is not the same as a Range object in Word - you
should probably make "Dim rngx as Word.Range"

Andrew



On 12 Jan, 17:44, Ruth wrote:
Hi Andrew

Thanks a lot for your help! I had a look to the links and I decided to go
for the second one but still struggling with some problems.

Case "Text3"
If Len(Range("T" & fila)) 255 Then
wdFF.Result = Left$(Range("T" & fila), 250)
MyDataObj.SetText ""
MyDataObj.PutInClipboard
MyDataObj.SetText Mid$(Range("T" & fila), 256)
MyDataObj.PutInClipboard
Set rngx = wdFF.Range
rngx.GoTo
rngx.Select
With wordFile.Selection
.Collapse wdCollapseEnd
.Paste
End With
Else
wdFF.Result = Range("T" & fila)
End If

The situation now is that I get the 255 initial characters, it even clear
properly the clipboard and copy there the rest of the text but then I get an
error because it says that "Set rngx = wdFF.Range" use non compatible formats
(rngx is defined as a range). Any idea of what I coud do? Thanks!!

"Andrew Taylor" wrote:
Hello again Ruth


It seems that the fact you;re doing it from Excel is irrelevant here -
you can't directly set a text formfield to more than 255 characters,
though you can do it "manually" within Word.


See this MS article, which gives a rather klunky workaround:
http://support.microsoft.com/default...;en-us;Q163192
(using search and replace in the field)


See also
http://groups.google.co.uk/group/mic...vba/browse_thr...
which has a different method using copy & paste.


Andrew


On 11 Jan, 11:04, Ruth wrote:
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!!