ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign a Hyperlink to a button (https://www.excelbanter.com/excel-programming/423259-assign-hyperlink-button.html)

Mike K

Assign a Hyperlink to a button
 
Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


Dave Peterson

Assign a Hyperlink to a button
 
If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


--

Dave Peterson

Gary''s Student

Assign a Hyperlink to a button
 
Put ANY piece of ClipArt on the worksheet. (if you like buttons, use a
rectangle from AutoShapes)

Right-click the Object and pick Hyperlink from the resulting menu.
--
Gary''s Student - gsnu200830


"Mike K" wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


Mike K

Assign a Hyperlink to a button
 
No problems when assigning the hyperlink, but when I click it I get an error
"Cannot open specified file"

"Gary''s Student" wrote:

Put ANY piece of ClipArt on the worksheet. (if you like buttons, use a
rectangle from AutoShapes)

Right-click the Object and pick Hyperlink from the resulting menu.
--
Gary''s Student - gsnu200830


"Mike K" wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


Mike K

Assign a Hyperlink to a button
 
Dave,
Getting and error "Compile error, variable not defined" when
running.

Mike

"Dave Peterson" wrote:

If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


--

Dave Peterson


Dave Peterson

Assign a Hyperlink to a button
 
You changed something and didn't share what you did.

I don't have a guess how you changed it.


Mike K wrote:

Dave,
Getting and error "Compile error, variable not defined" when
running.

Mike

"Dave Peterson" wrote:

If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


--

Dave Peterson


--

Dave Peterson

Dave Peterson

Assign a Hyperlink to a button
 
You changed something and didn't share what you did.

I don't have a guess how you changed it.


Mike K wrote:

Dave,
Getting and error "Compile error, variable not defined" when
running.

Mike

"Dave Peterson" wrote:

If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


--

Dave Peterson


--

Dave Peterson

Dave Peterson

Assign a Hyperlink to a button
 
I'd guess you don't have a file with that filename in that path.

Mike K wrote:

No problems when assigning the hyperlink, but when I click it I get an error
"Cannot open specified file"

"Gary''s Student" wrote:

Put ANY piece of ClipArt on the worksheet. (if you like buttons, use a
rectangle from AutoShapes)

Right-click the Object and pick Hyperlink from the resulting menu.
--
Gary''s Student - gsnu200830


"Mike K" wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike


--

Dave Peterson

Mike K

Assign a Hyperlink to a button
 
Dave,
Thanks for your time and effort. I already use that file in a
regular hyperlink in a cell. Nothing has been changed. I copy/pasted your
whole macro. At this point I can use workbook_open on a button(I recorded it
and it worked) , I was just trying to use the hyperlink in a macro to see
how it worked.

In summery:
this function IN A CELL works:
=HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\ Filler\Filler%
Datasheet.xls","Filler %")

The fonts on my cell hyperlinks tend to get "adjusted" from time to time. I
thought buttons would work better when other people use them.


Thanks,
Mike


"Dave Peterson" wrote:

You changed something and didn't share what you did.

I don't have a guess how you changed it.


Mike K wrote:

Dave,
Getting and error "Compile error, variable not defined" when
running.

Mike

"Dave Peterson" wrote:

If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike

--

Dave Peterson


--

Dave Peterson


Dave Peterson

Assign a Hyperlink to a button
 
Make sure I didn't make a typo.

Make sure that the file exists in that location.

I tried it again and got a "cannot open file" prompt. I don't have that file
available.

Mike K wrote:

Dave,
Thanks for your time and effort. I already use that file in a
regular hyperlink in a cell. Nothing has been changed. I copy/pasted your
whole macro. At this point I can use workbook_open on a button(I recorded it
and it worked) , I was just trying to use the hyperlink in a macro to see
how it worked.

In summery:
this function IN A CELL works:
=HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\ Filler\Filler%
Datasheet.xls","Filler %")

The fonts on my cell hyperlinks tend to get "adjusted" from time to time. I
thought buttons would work better when other people use them.

Thanks,
Mike

"Dave Peterson" wrote:

You changed something and didn't share what you did.

I don't have a guess how you changed it.


Mike K wrote:

Dave,
Getting and error "Compile error, variable not defined" when
running.

Mike

"Dave Peterson" wrote:

If you used a commandbutton from the control toolbox toolbar, you don't assign a
macro to it. It has its own _click event.

If you go back to that button and double click on it (make sure you're in design
mode--another icon on that control toolbox toolbar), you'll see a code windo
open.

You can use a macro like:

Option Explicit
Private Sub CommandButton1_Click()
ThisWorkbook.FollowHyperlink _
Address:="File:\\\\S:\common\Lab\DataSheets\Asphal t\Filler\Filler%" _
& "Datasheet.xls"
End Sub

You could also use a shape from the drawing toolbar (or a insert a picture) and
directly assign the hyperlink to that shape/picture.



Mike K wrote:

Oh Wise Ones,
I have been searching old posts and cannot find
something that works for me. I would like to assign a hyperlink to another
sheet to a button. It was suggested to use the Follow Hyperlink event, but
it does not show up as an assignable macro. The command button click event
would not allow me to get to click mode on the button- always had crosshairs.
Obviously I'm doing something wrong, and some help would be much
appreciated.

1) Place a button on the worksheet.
2) click on it
3) takes me to:
HYPERLINK("file:S:\common\Lab\DataSheets\Asphalt\F iller\Filler%
Datasheet.xls" (not sure if the syntax is right, its what I use in a
cell)

Thanks,
Mike

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 12:00 AM.

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