Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default CommandButton to open a Excel workbook

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default CommandButton to open a Excel workbook

Sorry to have to say The code you provided is not working. I think you have
misunderstood my question. The commandbutton is in the workbook that I am
using, the code you gave closes this workbook and then reopens it... but that
is not what i want. I want the command button to open another/different
workbook altogether, where I keep references and reports.

"Gary''s Student" wrote:

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

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
how do i open a data workbook when i open a timesheet workbook [email protected] uk Excel Discussion (Misc queries) 2 January 4th 09 04:50 PM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
CommandButton in Excel to open another Application JohannM Excel Worksheet Functions 0 September 13th 06 09:29 PM
How do I open my excel workbook? ajojoel Excel Discussion (Misc queries) 5 April 21st 05 07:41 AM
Excel workbook does not open in open window on desktop DeanH Excel Discussion (Misc queries) 2 March 8th 05 09:51 AM


All times are GMT +1. The time now is 11:33 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"