Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Command Button VB Code w/hyperlinks

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Command Button VB Code w/hyperlinks

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Command Button VB Code w/hyperlinks

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Command Button VB Code w/hyperlinks

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Command Button VB Code w/hyperlinks

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button code dummy Excel Discussion (Misc queries) 2 December 1st 09 02:57 PM
Command button code Ram[_5_] Excel Programming 2 June 12th 07 04:33 AM
Command button code packwolf94 Excel Programming 3 April 26th 07 07:54 AM
Command button code taps54 Excel Programming 3 September 21st 06 01:16 PM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"