By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,526 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,526 IT Pros & Developers. It's quick & easy.

Excel automation causes runtime error 1004 on second attempt

P: n/a

I have used Excel automation many times in the past without error until now.
My machine has both Access 97 and XP installed but this code is written in
97 and I am using Excel XP. The code below is running in my database:

Dim exl As Excel.Application

Set exl = New Excel.Application
exl.Workbooks.Open ("C:\Test\ Listing.xls")
Excel.Run "sheet1.LFooter"
Excel.Workbooks(1).Close True
Set exl = Nothing

The first time it runs it runs without error. If I try to run it again
without first closing the database I get a runtime error 1004 'The macro
sheet1.LFooter can't be found'. I have also gotten this same runtime error
1004 with different messages during different attempts. If I close the
database after the first run it works fine. I have the Excel reference
checked as well. Any help would be much appreciated.

Thanks in advance,
Mark C.
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.