Announcement

Collapse
No announcement yet.

Attaching Hyperlink To Command Button

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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

    New users should read the Forum Rules before posting

    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.

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          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

          New users should read the Forum Rules before posting

          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.

          Comment


          • #6
            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

            Comment


            • #7
              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.

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

              Cheers,

              dr
              Cheers,

              dr

              "Questions, help and advice for free, small projects by donation. large projects by quote"

              http://www.ExcelVBA.joellerabu.com

              Comment


              • #8
                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?

                Comment


                • #9
                  Re: Attaching Hyperlink To Command Button

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

                  Roy

                  New users should read the Forum Rules before posting

                  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.

                  Comment

                  Working...
                  X