Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error with EXCEL macro transfering information to a form in WORD
Hi
I have programmed a macro in EXCEL to transfer the information in a row in EXCEL to a form previously defined in Word. The routine I use is below and it is working with the exception of one of the cells (the one copied to Text3). The problem is the cell in EXCEL contains a long text and when copied to the form in WORD does not work because it seems it is expecting to see a String and the information in the cell does not fit in a String (is much longer). I get in execution an error because the information is too long. Any work around to this? I just extracted here (full text below) the way I programmed it. If wdFF.Name = "Text3" Then wdFF.Result = Range("T" & fila) End If "Text3" is the identifier in the WORD form to which the information has to be copied. Dim wordApp, wdFF As Object, wordFile As Object, myFile As String, I, fila As Integer myFile = "NEW_FORM.doc" Set wordApp = CreateObject("Word.Application") Set wordFile = wordApp.Documents.Open(myFile) ....... fila = 3 I = 1 For Each wdFF In wordFile.Formfields If wdFF.Name = "Text1" Then wdFF.Result = Range("H" & fila) End If If wdFF.Name = "Dropdown2" Then wdFF.DropDown.Value = Left(Range("A" & fila), 1) + 1 End If If wdFF.Name = "Text3" Then wdFF.Result = Range("T" & fila) End If ................... I = I + 1 Next wordApp.Quit Set wordFile = Nothing Set wordApp = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transfering information form one cell to another work sheet | Excel Worksheet Functions | |||
transfering data from word form to an existing spreadsheet | Excel Discussion (Misc queries) | |||
Copy information from Excel to Word using 1 macro | Excel Discussion (Misc queries) | |||
How do I put my information form Excel into a Word Merge Form? | Excel Discussion (Misc queries) | |||
Using a macro how do I transfer information from excel to word. | Excel Programming |