View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike K Mike K is offline
external usenet poster
 
Posts: 104
Default 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