PC Review


Reply
Thread Tools Rate Thread

Command Button VB Code w/hyperlinks

 
 
Glenn
Guest
Posts: n/a
 
      17th Apr 2008
This should be easy, but...
I want to hard code a hyperlink (URL) in the code for a command button, via
> Private Sub CommandButton1_Click()

what code goes here....?
> End Sub

I'm using Excel 2003.
By clicking the command button I want to open a browser and connect to the
URL coded.

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      17th Apr 2008
ThisWorkbook.Hyperlinks.FollowHyperlink Address:="Http://www.microsoft.com"

You may want to use a control from the Drawing toolbar (prettier shapes???) and
rightclick and use Assign hyperlink.

Glenn wrote:
>
> This should be easy, but...
> I want to hard code a hyperlink (URL) in the code for a command button, via
> > Private Sub CommandButton1_Click()

> what code goes here....?
> > End Sub

> I'm using Excel 2003.
> By clicking the command button I want to open a browser and connect to the
> URL coded.


--

Dave Peterson
 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      17th Apr 2008
Here is code for a Forms Button:

Sub Button1_Click()
MsgBox (" ")
ActiveWorkbook.FollowHyperlink Address:="http://www.cnn.com"
End Sub
--
Gary''s Student - gsnu200779


"Glenn" wrote:

> This should be easy, but...
> I want to hard code a hyperlink (URL) in the code for a command button, via
> > Private Sub CommandButton1_Click()

> what code goes here....?
> > End Sub

> I'm using Excel 2003.
> By clicking the command button I want to open a browser and connect to the
> URL coded.
>

 
Reply With Quote
 
Glenn
Guest
Posts: n/a
 
      17th Apr 2008
Related to the 'Address' line I get a compile error, indicating it's
expecting an expression. This applies to your solution and the one supplied
by Gary''s Student. I may need to use your alternate idea, but for now I'd
like to learn how to make this work. I'm sure there's a way, but.....? As
in all things VB, syntax and other considerations (knowledge and experience)
are paramount to success. I don't know if there is different functionality
as involves user forms and buttons, or what.
Thanks....

"Dave Peterson" wrote:

> ThisWorkbook.Hyperlinks.FollowHyperlink Address:="Http://www.microsoft.com"
>
> You may want to use a control from the Drawing toolbar (prettier shapes???) and
> rightclick and use Assign hyperlink.
>
> Glenn wrote:
> >
> > This should be easy, but...
> > I want to hard code a hyperlink (URL) in the code for a command button, via
> > > Private Sub CommandButton1_Click()

> > what code goes here....?
> > > End Sub

> > I'm using Excel 2003.
> > By clicking the command button I want to open a browser and connect to the
> > URL coded.

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Glenn
Guest
Posts: n/a
 
      17th Apr 2008
I did get this to work - I misinterpreted the word wrap as to syntax....my bad.
Thanks

"Dave Peterson" wrote:

> ThisWorkbook.Hyperlinks.FollowHyperlink Address:="Http://www.microsoft.com"
>
> You may want to use a control from the Drawing toolbar (prettier shapes???) and
> rightclick and use Assign hyperlink.
>
> Glenn wrote:
> >
> > This should be easy, but...
> > I want to hard code a hyperlink (URL) in the code for a command button, via
> > > Private Sub CommandButton1_Click()

> > what code goes here....?
> > > End Sub

> > I'm using Excel 2003.
> > By clicking the command button I want to open a browser and connect to the
> > URL coded.

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlinks in command button Peter Microsoft Access Form Coding 4 22nd Jan 2011 09:18 PM
Problems with Command Button Hyperlinks =?Utf-8?B?Q3JhaWcgSlggT2xzb24=?= Microsoft Access VBA Modules 0 1st Aug 2006 08:49 PM
Problems with Command Button Hyperlinks =?Utf-8?B?Q3JhaWcgSlggT2xzb24=?= Microsoft Access Forms 2 1st Aug 2006 08:25 PM
Problem with Command Button Hyperlinks =?Utf-8?B?Q3JhaWcgSlggT2xzb24=?= Microsoft Access Forms 0 27th Jul 2006 03:33 PM
Executing C code from a Command Button's code =?Utf-8?B?bmpj?= Microsoft Word Document Management 1 19th Apr 2004 10:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:49 PM.