+ Reply to Thread
Results 1 to 6 of 6

Using a Active X command button to activate a hyperlink

  1. #1
    Forum Contributor
    Join Date
    01-05-2009
    Location
    South Dakota, USA
    MS-Off Ver
    2003, and 2007
    Posts
    150

    Using a Active X command button to activate a hyperlink

    I recorded a macro and came up with this

    Please Login or Register  to view this content.
    R6 is a hyperlink, and it worked when recording the macro but when I used the cmd button, came up with error message "select method of range class failed"
    Is there a place that I need to tell it that R6 is a hyperlink?

    Thanks for your help

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using a Active X command button to activate a hyperlink

    Hello 2funny4words,

    If there is no hyperlink in "R6" the code will error.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    01-05-2009
    Location
    South Dakota, USA
    MS-Off Ver
    2003, and 2007
    Posts
    150

    Re: Using a Active X command button to activate a hyperlink

    Leith, I come up with a subscript out of range error. I tried to play with it but no success. Any suggestions?

    Here is the trail.

    r6 =HYPERLINK(R3,"Weather")

    r3 ="http://www.wunderground.com/history/airport/KVTN/"&TEXT(Form!H17,"yyyy/mm/dd")&"/DailyHistory.html"

    Form!h17 is a date validated cell for user input
    Last edited by 2funny4words; 04-25-2009 at 11:47 AM.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using a Active X command button to activate a hyperlink

    Hello 2funny4words,

    The macro I wrote for Hyperlinks will not work if you are using the worksheet function =HYPERLINK() to create hyperlinks on the worksheet. Hyperlinks created this way are not available to VBA. I have no idea why this is, just that is this way.

    I am confused by what you are doing. Are you writing a VBA macro or are you using worksheet formulas or a combination of the two? It would help to know in detail what you want to do. Posting your workbook would provide the quickest answers to any questions. Since it appears you are using Excel 2007, it would help to know if the workbook is in Excel 2007 format or saved in some earlier Excel version. The more clear you are about you want and the more detail you can provide, the quicker people can provide you with accurate, and customized solutions.

  5. #5
    Forum Contributor
    Join Date
    01-05-2009
    Location
    South Dakota, USA
    MS-Off Ver
    2003, and 2007
    Posts
    150

    Re: Using a Active X command button to activate a hyperlink

    Leith, I believe to answer your question, I am using both. I will attach a copy of the workbook, I am using 2003 version at the Fire Hall so everything will be saved as 03 but my laptop is 2007 and I did do some editing with the laptop but I don't think that that should make a difference? I honestly am learning as I go and if you have any suggestions to clean up the looks of things or make codes easier to run or better I am all for learning more.

    The first sheet of the workbook is the form that the user will fill out. The weather button is between the first and second section of the first page on sheet1.

    The only difference between the sheet that I uploaded and the real one is that I replaced a few names with numbers

    Thanks for all of your help

    P.S. this is not the same workbook as the other one that you are helping with on the data validation.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-05-2009
    Location
    South Dakota, USA
    MS-Off Ver
    2003, and 2007
    Posts
    150

    Re: Using a Active X command button to activate a hyperlink

    Is there a way to create the same hyperlink with a code instead of a formula?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1