Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Mar 2008
    Location
    Frederick, Maryland, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Establishing Cell Range word/paragraph delimiter (Word 2003)

    I have been making a vain attempt to establish a paragraph or word delimiter between line items in a cell. I initially thought there would be a paragraph delimeter, but as it turns out there is only a space separating the line items (which could be one or many items).

    Is there a recommended way to do this short of writing code to look at all the characters, then try to establish how many spaces exist, then do something....?

    I have attached screen shot debug details of what my code results are. Any help would be greatly appreciated.

    Thanks
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Establishing Cell Range word/paragraph delimiter (Word 2003)

    From the screen shots, I'd guess that there really *is* a space between the text strings VIII.A.2-b and VIII.A.1-b instead of a paragraph break, and that they are displayed on two lines because of the width of the column. You should ask yourself why that is, and if it could have been avoided.

  3. #3
    New Lounger
    Join Date
    Mar 2008
    Location
    Frederick, Maryland, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Establishing Cell Range word/paragraph delimiter (Word 2003)

    I inherited the document and it is used as a source document for which I am doing other things with. Is it prudent to insert a bookmark, if so, how would it be done. For you with vast experience with such anomalies, how would you recommend to best resolve?

    Thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Establishing Cell Range word/paragraph delimiter (Word 2003)

    Without knowing the contents and purpose of the document it's hard to say...
    You could replace spaces with paragraph breaks (^p) within the cell range, then use the code you already had.

  5. #5
    New Lounger
    Join Date
    Mar 2008
    Location
    Frederick, Maryland, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Establishing Cell Range word/paragraph delimiter (Word 2003)

    All, I have been struggling with this problem since yesterday; about to throw my computer out the window or just break down and cry. I to walk down a column cell by cell and tag each line item in each cell bookmark it and send it to MS Access as a link.

    Unfortunately the line items are separated by a space and not by a paragraph break. I have attempted to insert a paragraph break, but to no avail. This has really thrown a "hitch" in my "giddy-up" to the point I am crying out to anyone.

    Any help?

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Establishing Cell Range word/paragraph delimiter (Word 2003)

    Hi dejones,

    You could try something like this code, which asks you to input the numbering used to start the sequence of 'paragraphs' (in your example's case, 'VIII'):
    <code>Sub UpdateTable()
    Dim oTbl As Table
    Dim oCell As Cell
    Dim oRng As Range
    Dim strTestText As String
    Dim strText As String
    If Selection.Information(wdWithInTable) = True Then
    strTestText = Trim(InputBox("Please Input The Test String"))
    For Each oTbl In Selection.Tables
    For Each oCell In oTbl.Range.Cells
    Set oRng = oCell.Range
    oRng.MoveEnd UNIT:=wdCharacter, Count:=-1
    If InStr(oRng.Text, " " & strTestText) > 0 Then
    strText = Replace(oRng.Text, " " & strTestText, vbCrLf & strTestText)
    oCell.Range.Text = strText
    End If
    Next oCell
    Next oTbl
    End If
    End Sub</code>
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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