+ Reply to Thread
Results 1 to 2 of 2

Excel to Word with long text strings.

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Excel to Word with long text strings.

    I am looking to input text from a varying number of cells into Word by using a find and replace funtion. The cell content is longer than 255 characters and therefor giving me an error. any suggestions?

    Thanks!

  2. #2
    Registered User
    Join Date
    06-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Excel to Word with long text strings.

    This is what I have so far - but am getting the "string parameter too long" error

    Dim xl As Excel.Application
    Dim wkbk As Excel.Workbook
    Dim wk As Excel.Worksheet

    Set xl = CreateObject("Excel.Application")
    Set wkbk = xl.Workbooks.Open("C:\Users\..............xlsx")
    Set wk = wkbk.Sheets(1)

    Dim placeholder() As String
    Dim prompt() As String
    Dim i As Integer

    bb = wk.Range("E2").Value

    ReDim num_identifiers(1 To bb)
    ReDim placeholder(1 To bb)
    ReDim prompt(1 To bb)

    For i = 1 To bb
    placeholder(i) = wk.Cells(2 + i, 1)
    prompt(i) = wk.Cells(2 + i, 2)

    With Selection.Find
    .Text = placeholder(i)
    .Replacement.ClearFormatting
    .Replacement.Text = prompt(i)
    .Execute Replace:=wdReplaceAll, Forward:=True, _
    Wrap:=wdFindContinue
    End With

    Next i

    Workbooks.Close

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1