• Go to a specific cell (Word 97 SP2)

    Author
    Topic
    #360489

    In a macro, is it possible to go to specific cell in a table without using a bookmark?

    I want to change the backgound colour of a cell when an e-mail action has been performed – to show that the e-mail has been sent.

    Word seems to allocate cell identifiers as in Excel: C1, D2 etc and uses them in calculations. Is it possible to send the cursor to say, cell C2, so that a change colour routine can run?

    If all else fails – can you hide the bookmark I-bar? Much to my surprise it does not dissappear when show codes is switched off.

    Viewing 1 reply thread
    Author
    Replies
    • #542950

      Not easily (that I know of). Suggestion – use Go to Table (you’ll need to know what number the table is in the document) and then use cursors to go down and along as necessary.

      Anyone got a neater solution?

      And yes, you can hide the bookmark I-bar – in fact it is off by default – Tools, Options, View, Show – Bookmarks (uncheck, obviously).

    • #543046

      How are you defining the table? The following demonstrates colouring a cell in the first table in a document.

      With ActiveDocument.Tables(1).Cell(3, 2).Shading
        .Texture = wdTextureNone
        .ForegroundPatternColorIndex = wdAuto
        .BackgroundPatternColorIndex = wdRed
      End With

      ActiveDocument could be replaced with Selection if you wanted the currently selected table

      • #543083

        Thanks Andrew – exactly what I wanted and works well.

        David

    Viewing 1 reply thread
    Reply To: Go to a specific cell (Word 97 SP2)

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

    Your information: