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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACCESS TO EXCEL

Status
Not open for further replies.

iain2003

MIS
Jan 16, 2003
9
GB
Hi,

I am trying currently in vain to get an Access database to simply open an Excel spreadsheet located on a network and select a specific sheet. This needs to be achieved through the click of a comand button on a user form.

I have searched through all threads with keywords "Access" and "Excel" and have tried it all relevant VBA procedures! Nothing seems to work.

Can anyone help?

Thanks in advance
 
Reference the excel object library

Then

Workbooks.Open "filename"

should work.
 
This should work

Dim objex As Excel.Application
Set objex = New Excel.Application

objex.Workbooks.Open "filename"
objex.Visible = True
 
Just a thought...see if this works for you...

You can create a macro that contains the RunApp command:

On the command line type the full path of the Excel location and the full path of the spreadsheet you want to open. (enclose each path in quotes and insert a space between the two paths)

This will only work if excel is installed in the same location on all computers accessing this file.

Ex: "D:\Program Files\Microsoft Office\Office10\excel" "E:\My Documents\ip.xls"

Run the macro from the command button and you should be good to go.
 
Thanks Guys,

Dyarwood, your code works fine but I still cannot select the actual sheet I want the user to view.

Cheers
 
objex.Sheets("Sheet2").Activate

This line on the end of what i gave you would allow the user to view Sheet2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top