Opening Excel with a command button (1 Viewer)

Chris1985

Registered User.
Local time
Today, 19:13
Joined
Jul 2, 2013
Messages
33
I am trying to open MX Excel using a command button. I have tried using a hyperlink a various codes that i have found online with no luck. The Excel file is being used by the Access as it bring data from the spreadsheet a displays it within a subform. (I think this is where the problem occurs) The subform displaying some data from Excel is working fine but when i click my hyperlinked button i am met with errors and the file will not open.

Does anyone know a way around this?

Thanks.
 

Chris1985

Registered User.
Local time
Today, 19:13
Joined
Jul 2, 2013
Messages
33
I can am unable to open the file at all when access is running so this is why i think the fact that the database is calling data from the excel file is causing the problem.

Thanks for any help!
 

Chris1985

Registered User.
Local time
Today, 19:13
Joined
Jul 2, 2013
Messages
33
Help.......... LOL
 

way2bord

Registered User.
Local time
Today, 11:13
Joined
Feb 8, 2013
Messages
177
If you KNOW your command button should work and it's not, then MS Access probably already has the excel file open - likely in an exclusive/editing mode preventing any other users access. Revise your subform code to open the file in a read only sharing mode or as a snapshot. Or alternatively, edit your command button to try top open a snapshot of the excel file.
 

Chris1985

Registered User.
Local time
Today, 19:13
Joined
Jul 2, 2013
Messages
33
How can i do this? I have posted this on a forum and nobody seems to be able to help me! I am able to view the excel file through the database but when the database is running i am unable to open the excel file using a command button or going directly to the file and opening it there i get the same error "cannot access excelfile.xls"
Thanks
 

way2bord

Registered User.
Local time
Today, 11:13
Joined
Feb 8, 2013
Messages
177
Test your command button to ensure it works. Do this by completely removing the subform and then testing the command button. It should open the excel file as expected.

If this does not occur, there is a problem in your button coding and the problem is independent of any subform conflict. Post the code for your command button for review.

If the command button works fine, please post the code for your subform for review.
 

Chris1985

Registered User.
Local time
Today, 19:13
Joined
Jul 2, 2013
Messages
33
i have completed removed the subform and my button worked fine.

- Here is the code for my subform

Workbooks.Open filename:="C:\Documents and Settings\cjacobs\Desktop\CustomerDatabase\Quote.xls", ReadOnly:=True

thanks
 

Users who are viewing this thread

Top Bottom