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!

From a form launch Excel and chosen file 1

Status
Not open for further replies.

littleboots

Technical User
Nov 5, 2002
13
GB
I've designed a form with buttons that link to my reports in a dbase. I need to also add buttons that link to files in Excel.
I have discovered how to launch Excel via a button on a form, but I can't get it to open a particular file at the same time. I've tried doing it through Visual Basic but as I've no experience in that area I've had no success.
Is it possible to launch Excel and open a file using an Expression?
 
Hi

You say you know how to launch Excel, are you doing this with Shell command, if yest, put the nale of the file you want to open on the command line

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Hi Ken,

Thanks for your answer - but I'm new to Access and most of that went over my head! I've managed to launch Excel the basic way: Create a Form in Design View, select Command Button from the toolbox, select the category "Application", then selected "Run MS Excel" - but I can't see anywhere with that to add a file path....

Karen
 
In the code for your command button, you can remove your other code and try this, except, of course, replace the "\path\to\filename" with the correct path and filename:

Dim ExcelOutput As Object

Set ExcelOutput = GetObject "\path\to\filename")
ExcelOutput.Application.Visible = True
ExcelOutput.Parent.Windows(1).Visible = True

On Error Resume Next
ExcelOutput.Application.UserControl = True



That should work for you. Any questions, let me know.

Thanks,

GF

 
Hi goodfellah26

just read your nice code for opening an existing excel page
but can you add a piece for me please

How do you get the info from a query to add to this page.
The reason I ask is that I would have a Chart already waiting to receive the info.The code at the mom opens up ok
but I wish to use the info from Access to update the chart automaticaly.
Thanks a lot

Nick
 
Nevstic,
I haven't really used charts, so I don't have 1st hand knowledge. However, if you have an example of the database and the excel file, I could take a look. If not, I'll try to recreate an example. If you do, just send it to goodfela26@yahoo.com.

Btw, the code I posted was missing the leading parenthesis in the line:
Set ExcelOutput = GetObject "\path\to\filename")

It should be:
Set ExcelOutput = GetObject("\path\to\filename")

Heh, one too many backspaces when I was deleting my file name! :)

Thanks,

GF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top