Results 1 to 10 of 10
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't record directly into a macro?

    It's a favorite technique of mine to record a macro in order to see the sort of thing that I need to do in Word97/VBA. I agree with those who tell me it produces wretched code (try recording "View, header", for example) but it speeds up the process of my finding out a key part of some operation.

    So this morning, after r/c on a hyperlink and choosing Hyperlink, Edit Hyperlink, Remove Link from the ensuing dialogue, I bestirred myself to record a macro.

    What a surprise! I couldn't record a macro!

    Well, I could, but I couldn't record the r/c, let alone the pop-up menu.

    Undeterred I set the text cursor up ahead, started recording again, Ctrl-RightArrowed my way to the blue hyperlink, and from Word's main menu found Insert, Hyperlink (uh-oh, here comes a hyperlink on a hyperlink?) and removed the link that way.

    The recorded code is set out below.

    FWIW commenting out the two MOVE statements and navigating by hand prior to calling is just as effective; so presumably I have the makings of an "Unlink-all-hyperlinks" macro on my hands here.

    Question: Have you ever found things you can do regularly but can't record directly into a macro?


    <pre>Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 03/07/01 by Christopher Greaves
    '
    Selection.MoveRight Unit:=wdWord, Count:=6
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.Range.Hyperlinks(1).Delete
    End Sub
    </pre>


  2. #2
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    I never seem to be able to record the code for clicking the little x at the top right of the window.[img]/S/grin.gif[/img]

    Brooke.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    You just need to bit a little faster. It's there if you can catch it.


    <pre>Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 03/08/01 by Christopher Greaves
    '
    Application.Quit
    End Sub
    </pre>


  4. #4
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    For something so hard to trap, you think they'd put more in there!

    Brooke

  5. #5
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    Chris,

    It's been my experience that things which rely on cursor positioning cannot record- unless (sometimes) they can be reprocused by keystrokes.

    I cannot record changing the name of a form field, as this involves a right click on the form field.

    I can record selecting an Excel cell, as this is easily reproducible by keystrokes.

    Or it may be a right click does not record.

    Whatever, it has caused me problems, and added time to solving a problem.

    Microsoft Test (is it still their product?) can reproduce screen positioning and right clicks- it's a pity W2K cannot.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  6. #6
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Portland, Maine, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    I was trying to record something just last night.

    In Word. Tools, Customize, Options Tab.
    Uncheck Standard and formatting share one row.
    Uncheck Menus show recently used.
    Check Show Shortcut Keys in Screentips.

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    You blinked again, didn't you!!

    You just need to bit a little faster. It's there if you can catch it.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    I greatly miss the old Windows Recorder. For all that macros couldn't be edited, it sure was a nifty way of getting SOME things done.

    I wonder what design feature inhibits recording of the r/c. I remember being frustrated in Quattropro years ago .....

  9. #9
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't record directly into a macro?

    You're using Word2000, right? I don't have those options, but you're right. I can't record them in Word97SR2 either.

  10. #10
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Can't record directly into a macro?

    The inability to record the right-click is the same as the inability to record the display of any Word menu or dialog: what's being recorded is not the menu display per se (and/or any submenus along the way) but rather the Word command or commands that are triggered when you click on the item in the menu (and/or any properties settings that are exposed by the dialog).

    The limitations with recording macros relating to hyperlinks appears to be by design - I recall being unable to do so in Word 97 and recall the same limitation in Word 2000 when I tried. There are of course properties and methods relating to hyperlinks in the Word VBA object model, but many are not recordable. It would be interesting to know why this was left this way....

Posting Permissions

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