View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default CommandButton to open a Excel workbook

Try something like:

Sub Button1_Click()
ActiveWorkbook.FollowHyperlink Address:="file:///C:\test\gamma.xls"
Sheets("Sheet2").Activate
End Sub

Using the hyperlink will take you to the workboook if it already open.
Otherwise, it will open the workkbook, activate it and allow you to activate
any sheet within the workbook
--
Gary''s Student - gsnu200840


"aussiegirlone" wrote:

I have a command button that when clicked goes to another Worksheet. Can this
command button code be edited to goto another WorkBook instead?

Private Sub CommandButton1_Click()
Worksheets("HoursWorked").Select
Application.Goto Worksheets("HoursWorked").Range("A1"), Scroll:=True 'or
false??
End Sub