Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Andrew,
Yes I did and it is not the same. Thanks for the help! Now seems to be completly working. Per, the problem with the approach that you suggest is that it is more than 510 characters then you have to include a third field and so on, ... This is the code I finally used and it is working .... If Len(Range("T" & fila)) 255 Then wdFF.Result = Left$(Range("T" & fila), 255) MyDataObj.SetText "" MyDataObj.PutInClipboard MyDataObj.SetText Mid$(Range("T" & fila), 1) MyDataObj.PutInClipboard wordFile.Unprotect Set rngx = wdFF.Range rngx.GoTo rngx.Select rngx.Paste wordFile.Protect Type:=2, NoReset:=1 Else wdFF.Result = Range("T" & fila) End If Of course rngx not defined as an excel range!! Well, thanks to all you guys for your help!! "Andrew Taylor" wrote: 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!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
long text string | Excel Programming | |||
Importing Long String - String Manipulation (INVRPT) (EDI EANCOM 96a) | Excel Programming | |||
Importing Long String - String Manipulation (EDI EANCOM 96a) | Excel Programming | |||
From String to Long | Excel Programming | |||
converting a string to long | Excel Programming |