Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    Dear Stumped,

    If you are not vertically challenged or participating in a reforestation project, then just press the BACK button. <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

    Signed,

    Wise Acre
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

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

    Re: return via Hyperlink field

    I'm sorry, kevin, I should have made myself clearer: I want to do it via a VBA procedure.

  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

    return via Hyperlink field

    How does one return via a VBA procedure, to a document from which one jumped via a hyperlink field?

    The code below assumes the text cursor is on a blue hyperlink field. Executing the macro performs the equivalent of left-clicking on the blue hyperlinked field - you should find that you are in the document which is the target of the hyperlink; you have jumped from the original document to a linked document.

    Now, how to jump back? via a VBA procedure.

    Recording a macro doesn't do the trick.

    There's very little (aka "'nothing") in the VBA help file under Hyperlink.

    I see nothing in the various Properties or Methods that gives me a clue.


    <pre>Sub test()
    MsgBox ActiveDocument.FullName ' my starting point.
    Selection.Hyperlinks(1).Follow ' assumes I am on a {Hyperlink}.
    MsgBox ActiveDocument.FullName ' jumped to hyperlinked document.
    End Sub
    </pre>



    (signed) "stumped" of Toronto.

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

    Re: return via Hyperlink field

    Chris,

    Do the conditions of your VBA procedure afford you the opportunity to set an object variable to the original document, before the follow hyperlink stuff happens? - 'cause then it would be an easy matter to reactivate objDocOrig.

    GarY

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

    Re: return via Hyperlink field

    Thanks, Gary. I'll try this as soon as I get home, and BEFORE I dig for truffles for Kevin. I'll post the (working) source code here, later today; much later.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    Chris,

    Well, I kinda knew that and since I don't have a solution for you (but I did look into it), I'd thought I'd try to brighten your day with a little <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15> dumb humor.

    And... I'm still trying a few things.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    What about this solution:

    Since clicking a hyperlink to a document from a document just opens a document, why not return to the previous document with an alt-F6.

    Codewise we're talking a simple

    ActiveWindow.Previous.Activate
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  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: return via Hyperlink field

    > What about this solution?

    Well, for one thing, it doesn't work. Open a document; choose Windows; 1 window in the list. Click on a hyperlink. Choose Windows; 1 Window in the list.

    Hyperlinks somehow replace the active document with another document. They don't open a separate document. We need someone like Charles Kenyon or Chris Greaves to use words like "object layering" etc.


    An earlier thread and/or article expressed surprise that here is yet another facet of MSWord that doesn't lend itself to exploration via a recorded macro.


    OK. back to work on APIProfile Strings ....

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    That's bizarre, 'cause I tried putting a hyperlink to doc2 in doc1, clicked on the link, Word opened doc2 and the Windows list then had 2 docs open: doc1 and doc2. Word 97 SR-2.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  10. #10
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    Ok, thmarty, here you go. No charge:


    commandbars("web").Controls(1).Execute
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

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

    Re: return via Hyperlink field

    Good lateral thinking. <img src=/S/clever.gif border=0 alt=clever width=15 height=15>

    But (you knew there was a but!):
    what if, like me, you have dragged all of the buttons off of the default web toolbar or,
    like Chris, you have run a macro to disable this toolbar?

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

    Re: return via Hyperlink field

    >commandbars("web").Controls(1).Execute

    As Gary pointed out, "You left out the middle bit"

    <pre>Sub test()
    Dim iButton As Integer
    For iButton = 1 To CommandBars("standard").Controls.Count
    ' Debug.Print CommandBars("standard").Controls(iButton).Descript ionText
    If "Backward hyperlink" = CommandBars("standard").Controls(iButton).Descript ionText Then
    CommandBars("standard").Controls(iButton).Execute
    Else
    End If
    Next iButton
    End Sub
    </pre>




    To Kevin: Thanks again, my pal, for giving me a push in the right direction. The way is now clear for a really good toolbar macro that sits on a toolbar menu and lets the user choose an action from ANYTHING that Word97SR2 has to offer. The code would probably require a loop through all toolbars looking at each button, and then .Executing the matching one.


    Hmmmmmmmmm

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

    Re: return via Hyperlink field

    I see what your problem is - your hands are too close to your mouth!



    OK. I can't do it. I even took a look through Tools, Options to see if there was an item right next to "print colours as black on laser printers" that said "If username is Kevin, retain the old window". Nope. Strange.

  14. #14
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    I leave those out on purpose....

    'cause I like to watch your brain work in subsequent posts.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  15. #15
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: return via Hyperlink field

    Shame on you! Disabling a Microsoft product so as to alter it's default behavior. Don't you know that sort of independent thinking could start a revolution or something.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Page 1 of 2 12 LastLast

Posting Permissions

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