ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   open web page by clicking label1 of the form1 (https://www.excelbanter.com/excel-programming/380962-open-web-page-clicking-label1-form1.html)

musa.biralo

open web page by clicking label1 of the form1
 
Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo


NickHK

open web page by clicking label1 of the form1
 
Muso,
Here's one way:

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

Private Sub Label1_Click()
Call ShellExecute(0&, vbNullString, Label1.Caption, vbNullString,
vbNullString, vbNormalFocus)
End Sub

NickHK

"musa.biralo" wrote in message
ups.com...
Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo




Dave Peterson

open web page by clicking label1 of the form1
 
Another way:

Option Explicit
Private Sub Label1_Click()
ThisWorkbook.FollowHyperlink Address:="http://" & Me.Label1.Caption
End Sub



"musa.biralo" wrote:

Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo


--

Dave Peterson

musa.biralo

open web page by clicking label1 of the form1
 
Thanks a Bunch....Nick
it worked...
musa.biralo


NickHK wrote:
Muso,
Here's one way:

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

Private Sub Label1_Click()
Call ShellExecute(0&, vbNullString, Label1.Caption, vbNullString,
vbNullString, vbNormalFocus)
End Sub

NickHK

"musa.biralo" wrote in message
ups.com...
Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo



musa.biralo

open web page by clicking label1 of the form1
 
Cool...thanks Dave
short and sweet!

Can we assign a mouse pointer like "hand"? Currently it's has the
default regular one.
Let's say i chose one of the pointer from my computer. will that be
available to my friends computer?

Just curious...

thanks again
musa.biralo


Dave Peterson wrote:
Another way:

Option Explicit
Private Sub Label1_Click()
ThisWorkbook.FollowHyperlink Address:="http://" & Me.Label1.Caption
End Sub



"musa.biralo" wrote:

Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo


--

Dave Peterson



Dave Peterson

open web page by clicking label1 of the form1
 
Yep. You can use any .cur file that you want. In my simple tests, it was saved
in the workbook.

I went into the VBE and clicked on the Label.
I showed its property window (hit F4)
I changed the MousePointer property to 99 (fmMousePointerCustom)
I clicked on the MouseIcon and browsed to my favorite .cur file (hand.cur???).

It seemed to work ok.


"musa.biralo" wrote:

Cool...thanks Dave
short and sweet!

Can we assign a mouse pointer like "hand"? Currently it's has the
default regular one.
Let's say i chose one of the pointer from my computer. will that be
available to my friends computer?

Just curious...

thanks again
musa.biralo

Dave Peterson wrote:
Another way:

Option Explicit
Private Sub Label1_Click()
ThisWorkbook.FollowHyperlink Address:="http://" & Me.Label1.Caption
End Sub



"musa.biralo" wrote:

Hi,
i am trying to open a web page, let's say www.google.com, by clicking
label in the form1. In simple words, form1 has label1 and caption is
www.google.com...i am trying to launch the web page with www.google.com
by clicking the label1. Is it possible?

your help will highly be appreciated.
Thank you.

musa.biralo


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com