Runtime Error 1004 : opening Excel file via VBA

  • Thread starter valereh via AccessMonster.com
  • Start date
V

valereh via AccessMonster.com

Good morning,

I am using the following code to open an excel file from an access database
(2003).

Set xlapp = New Excel.Application
xlapp.Visible = False
Address = "X:\QualityAssurance\Documents\QADocs.xls"
Set xlWbk = xlapp.Workbooks.Open(Address) -------------> Debug stops
here
Set xlsht = xlWbk.Worksheets("QA")
xlsht.Select

I use this code on the click event of a form and it works absolutely fine. In
another form, i get "runtime error 1004" message and it does not work. I have
been using this code for 3 years on a many buttons and i don't understand
what is wrong.

Thank you for the help.

Valère
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top