Results 1 to 12 of 12
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding hyperlink to excel userform (97 SR2)

    is it possible? A simple hyperlink, that's all.. any ideas?

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    Well, I found the answer, it seems there's no way to directly add a hyperlink to an excel userform.. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>, however there is a way to call a hyperlink which exists on a spreadsheet.

    The code to do this is as follows:
    Range("A1").Select ' Where A1 contains the hyperlink...
    Selection.Hyperlinks("http://wopr.com/lounge/").Follow NewWindow:=True, addhistory:=True

    The result is the Page opening up in a new Internet Explorer Window.

    If anyone knows of a cleaner method, EG, no reference to to the sheet I'm all ears!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

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

    Re: Adding hyperlink to excel userform (97 SR2)

    Drk,

    I think it can be done. I'm sure I've seen an example somewhere. I'm minded of <A target="_blank" HREF=http://www.j-walk.com>http://www.j-walk.com</A>. Give me a nudge if I haven't got back to you this time next year!

  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: Adding hyperlink to excel userform (97 SR2)

    <A target="_blank" HREF=http://j-walk.com/ss/excel/tips/tip71.htm>Found it!</A> Good old j-walk! Perhaps not as clean as would be liked, but it doesn't need the reference to a range.

  5. #5
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Adding hyperlink to excel userform (97 SR2)

    I added a label to a form, set the caption to the link and used:

    Shell "crogram filesinternet exploreriexplore.exe " & Chr(34) & Label1.Caption & Chr(34), vbMaximizedFocus

    Obviously you will have to change the location of the internet explorer program to match your system but this opens the site in a new instance of IE.

    Hope this helps.

    Cheers,

    Kevin Bell

  6. #6
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    How about just adding a label to the form and use the label's click even to fire this:
    <pre>Private Sub Label2_Click()
    ThisWorkbook.FollowHyperlink ("mailto:myname@yahoo.com")
    End Sub
    </pre>


    Deb

  7. #7
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    This is basically what I have in place now, the only problem with this is that when Excel follows the hyperlink, it minimizes itself and the userform, for some reason, after closing out the explorer session, my userform does not revert to it's previous state.

    I'll give some of these other methods a try, hopefully I can call the explorer session without impacting the application..

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  8. #8
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    Thanks BK, can you explain to me what the syntax of this statement means? E.G. where do I specify the linked site?

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  9. #9
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    All very strange as I tried it in xl97 (SR2) and I did see the error you saw BUT I did get it to work if I enabled the 'web tool bar'. <img src=/S/fanfare.gif border=0 alt=fanfare width=31 height=23> I also did it in xl2000 (SR2) and it worked great (with or without the web tool bar enabled). In xl97 I added a button to a sheet which called the form. The form had two labels, one with a mailto: (that worked fine) and the other with a http:// (which *worked* but then Excel isn't usable after you're done viewing the web page). The problem in xl97 was that when I exited the web page Excel was running but the ALL the worksheets and the form were hidden, just what you see.

    What browser did you use? I tried in both NS and IE and it only failed in IE when using Excel97. So the bad combination is Excel97 + IE without the web tool bar turned on.

    I hope this is a solution for you?!
    Deb

  10. #10
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    That was the same problem I was encountering... (The excel session was hidden, along with all userforms...) Meanwhile, the form code was still running, leaving the application *stuck* (I don't want to teach my users to hit CTRL+BREAK...) <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

    It seems the shell command above works like a charm, it opens the instance of I.E. without effecting the layout of Excel. Thanks for the input, problem solved! <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  11. #11
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    But that solution assumes the users have IE and that it's installed at that path so be careful.I tend to avoid shelling out since I've now lost control of my application. I personally would just write code to invoke the web tool bar since that solves the problem too. However, at this point you have a solution you like so that's that's good.

    Deb

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding hyperlink to excel userform (97 SR2)

    The great thing about our corporate environment is that all the machines are images of each other... The path for I.E. will always be there, so it's working great for me, but you do make a very good point! Now others reading this in the future will be able to make a sound determination based on the course of the thread... <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

Posting Permissions

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