Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 9 of 9

Thread: Attaching Hyperlink To Command Button

  1. #1
    Join Date
    6th March 2005
    Posts
    16

    Attaching Hyperlink To Command Button

    Hi........I am trying to attach a hyperlink to a command button in excel 2003. I open the control toolbox, select command button and place it on the worksheet. with the button selected and in design mode I click on the hyperlink button on the toolbar and allocate the hypelink address. Click on the button and it works fine untill I exit design mode then the button stops working. Can anybody advise me what I am doing wrong please.

    Thanks in anticipation.

    Nigel

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,314

    Re: Attaching Hyperlink To Command Button

    I'm not sure that you can attach a hyperlink to a Control Toolbox button. You need to write code for the button.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  3. #3
    Join Date
    6th March 2005
    Posts
    16

    Re: Attaching Hyperlink To Command Button

    Thanks for the reply Roy, I am not experienced with VBA ...is there any chance you could give me an example of the code? The worksheet I'm using is shared on a network and the command buttons would be used to link to other workbooks on the network not websites (in case that makes any difference).

    Thanks again and regards

    Nigel

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    1st November 2006
    Posts
    23

    Re: Attaching Hyperlink To Command Button

    If this does not have to be command button it would be much easier. In fact if you just want it to look like a command button you can use your draw tools to draw a rectangle. Then color it grey to look like a command button then overlay a text box with the appropriate text. Next all you do is right click on object -> selct hyperlink and put in the appropriate sheet or workbook. Hope this helps!

    Rex

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,314

    Re: Attaching Hyperlink To Command Button

    use the macro recorder whilst opening the file. That way you will get the right path in the code.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  6. #6
    Join Date
    6th March 2005
    Posts
    16

    Re: Attaching Hyperlink To Command Button

    I would prefer it to be a button if its possible so I will try and record the code via a macro as you suggested Roy......Many thanks.

    Regards

    Nigel

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    24th December 2004
    Location
    Nanaimo, Vancouver Island, British Columbia, Canada
    Posts
    2,464

    Re: Attaching Hyperlink To Command Button

    Hi nigebarrett,

    I played with this. I put a hyperlink in A1 and recorded a macro for the CommandButton. The recorded argument for NewWIndow was NewWindow=False.

    This resulted in a smaller than screen size window for the hyper linked file and the original file. Worse yet, when I returned to the original file my CommandButton was gone!

    Changing the NewWindow arg to true solved the problems.

    VB:
    Private Sub CommandButton1_Click() 
         
        Range("A1").Hyperlinks(1).Follow NewWindow:=True 
        ActiveWindow.WindowState = xlMaximized 
         
    End Sub 
    
    
    HTH,

    Cheers,

    dr

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    10th February 2007
    Posts
    12

    Re: Attaching Hyperlink To Command Button

    Is there a way to accomplish this with a dynamically-created button/lablel/other clickable item within a Userform?

    For clarification, I would like to dynamically create a clickable button that takes you to a specific URL.
    The main code in general creates a list of buttons on a userform (I know how to do this), but each one has its own hyperlink equivalent (for example, clicking on it calls a specific subroutine found elsewhere).

    I can accomplish this with pre-generated buttons, but I cannot seem to do this with dynamically-created ones.

    Any suggestions?

    Excel Video Tutorials / Excel Dashboards Reports


  9. #9
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,314

    Re: Attaching Hyperlink To Command Button

    Start your own thread, refer to this one if t helps.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Run Command Button Click From Another Command Button
    By ExcelJunkie in forum EXCEL HELP
    Replies: 11
    Last Post: January 1st, 2014, 23:02
  2. Replies: 2
    Last Post: October 5th, 2006, 15:47
  3. Replies: 6
    Last Post: January 13th, 2006, 18:11
  4. Attaching a Macro to a Command Button
    By Hube in forum EXCEL HELP
    Replies: 2
    Last Post: June 13th, 2005, 02:00
  5. Access : VBA attaching a Macro to a button
    By Bazman in forum EXCEL HELP
    Replies: 4
    Last Post: January 9th, 2004, 06:02

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
  •  
porno