Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering information form one cell to another work sheet Stephanie Excel Worksheet Functions 11 September 25th 09 12:56 AM
transfering data from word form to an existing spreadsheet Jose Excel Discussion (Misc queries) 1 October 15th 07 07:56 PM
Copy information from Excel to Word using 1 macro mathew Excel Discussion (Misc queries) 0 November 2nd 06 10:01 PM
How do I put my information form Excel into a Word Merge Form? Jackie Excel Discussion (Misc queries) 2 March 16th 06 08:16 PM
Using a macro how do I transfer information from excel to word. pandacordova Excel Programming 0 December 30th 05 07:41 PM


All times are GMT +1. The time now is 07:41 AM.

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

About Us

"It's about Microsoft Excel"