• Go To bypasses tables (Word 2002)

    Author
    Topic
    #441689

    Can anyone tell me why the Edit Go To Line command seems to bypass tables, and if there’s any way around this?

    With the attached file, for example, if you put the cursor at the start of the document and enter 8 or +8 as the line number, you’re taken to what – according to the Status bar – is line 13. And even if you’re already in the table, Word jumps out of it to do its business.

    While I can manually go to the “correct” line, I had planned to incorporate this as part of a VBA routine to go to a designated page and line.

    Viewing 0 reply threads
    Author
    Replies
    • #1061271

      That’s odd. Word seems to treat each table row as a single line for purposes of GoTo line. What exactly are you trying to do with this approach? There almost certainly is another way.

      • #1061412

        What we do here is periodically search 700+ Word documents and identify words or phrases. These are identified according to their location – on page 10, line 3 (for example). If the text found is in a table, VBA can correctly identify the line using Selection.Information(wdFirstCharacterLineNumber). What happens afterwards, however, is that some users try to go to each location using GoTo and the Page and Line options, and – presuming they remember to make the line references relative – still curse every time a table gets bypassed and they end up in the wrong location.

        To help the particularly grumpy types, I tried building a form in which users enter page and line numbers – but my attempt using “Selection.GoTo What:=wdGoToLine, Which:=wdGoToRelative, Count:=vntGoToLineNumber” to go to the designated line still bypasses a table.

        I suppose we could amend the original report to create hyperlinks to the locations in the other documents, but some users insist on working from a hard copy and our initial approach is to try and accommodate them as much as possible.

        • #1061415

          You could use Selection.MoveDown to position on the line. Here’s a rather simplistic example that could use a better UI:

          Sub GotoPageLine()
          Dim strPageLine As String, lngPage As Long, lngLine As Long
          Do
          strPageLine = InputBox("Enter page and line in the format shown" & _
          " (leave blank to cancel)", "Go to Spot", "1:20")
          If Len(Trim(strPageLine)) = 0 Then Exit Sub
          If InStr(1, strPageLine, ":") 1 Then
          Selection.MoveDown unit:=wdLine, Count:=lngLine - 1
          End If
          End Sub

    Viewing 0 reply threads
    Reply To: Go To bypasses tables (Word 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: