Results 1 to 14 of 14

Thread: SendKeys Will Not Work in Word 2007?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question SendKeys Will Not Work in Word 2007?

    Hello,

    I’m unsure how to update this macro for Word 2007 (Word/Window/VBA {version/build/Service Pack} specifics are below).

    It worked fine in Word 2003 via preselecting the cross-reference dialog box (for Table, etc.) so one simply makes a final selection in the variable area.

    I’ve been studying this “SendKey” issue, and the in the link http://vb.mvps.org/samples/SendInput/ it states “. . . in order to use the original SendKeys, you'll then have to prefix it with VBA.”

    That sounds simple, but this newbie is confused.

    Can somebody offer a solution (refitting this macro, or some OTHER VBA code) that will accomplish the same task?

    Always appreciative of any help/insight.

    Janet


    Sub CrossReferenceTable ()
        With Dialogs(wdDialogInsertCrossReference)
            SendKeys "%t"        '(Alt + T): To get to Reference {T}ype
            SendKeys "+(table)"  'Holds down shift to enter ALL letters (in case there is a "tabl{a}" caption that could roll out first
            SendKeys "{enter}"   'Enters parameters for the Reference Type
            SendKeys "%r"        '(Alt + R): To get to Insert {R}eference
            SendKeys "{down 1}"  'Selects "Only Label & Number" from pre-defined drop-down list
            SendKeys "{enter 1}" 'Enters parameters for Insert Reference
            SendKeys "%h"        '(Alt + h): To get to {H}yperlink
            SendKeys "+{+}"      '(Selects hyperlink checkbox -- even it if is already on -- does not toggle to and fro!
            SendKeys "{enter 2}" ' Enters parameters for hyperlink, & brings you to the {variable} area which end-user selects
            .Show
        End With
    End Sub
    Version Specifics, etc.:

    Word 2007:
    · MS Office Word 2007 (12.0.6545.5000) SP2 MSO (12.0.6545.5004)

    MS Windows
    · MW Windows Version 5.1 (Build 2600.xpsp_sp3_gdr.101209-1647:Service Pack 3)

    Visual Basic:
    · VBA: Retail 6.5.1040
    · MS Visual Basic 1987-2006
    · Version 1040
    · Forms3: 12.0.6415.100
    Last edited by Aussiebear; 01-26-2025 at 11:52 AM.
    "If" is a big 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
  •