Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a page in a spreadsheet with button on form

Status
Not open for further replies.

breukelen

Technical User
Oct 31, 2001
54
NL
Good Evening ,

When I click the button on a form I want to go
to a certain page of a certain Excell spreadsheet.
I probablely have to do this with VBA, but do not know how.
When I click the button now ,I open Excell.

Thanks in advance for your help,

Gunter

 
Hi Gunter,

Try this:

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlexcel As Excel.Worksheet

Set xlApp = New Excel.Application

' Open workbook
Set xlBook = xlApp.Workbooks.Open(Sheets("calcs").txtPrevMnthInvoice)

'Set xlBook = xlApp.Workbooks.Open("v:\wam\bo upgrade\invoice\aug 2001\WM LDZ Asset Invoice Evidence Aug 2001 Summary.xls")
' Reference the first sheet

Set xlexcel = xlBook.Worksheets(1)

Remember to make sure that you have the Microsft Excel x Object Library checked in Tools-->References (see any code window). Where x depends on what version u r using.
The above code works, but I am not sure whether the worksheet will open up hidden or not. Hope this is ok. If not, just let me know.

Nick (Everton Rool OK!)
 
Hello Nick ,

Thanks for your help , you got me moving again.



best regards ,

Gunter

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top