Excel Instance wont close form Access VBA

is "Rows.Count" referring to something in your database or your workbook object?
Either way, since it has dual applicability, it probably needs to be fully qualified.

Try that and update back.
I have a meeting and will look more later...
 
Yeah, that was it. But while I was trying to qualify it with "wb." (and got an error in return), it turns out it worked out fine with "xlApp."

I'll be honest to say I didn't get why it worked with the excel variable since, in my head, I'm counting the number of rows of the spreadsheet, and not of the excel application. Buuut, it worked out great.

Thanks for helping out!
 
I think it might have to do with how you've declared them.

instead of defining xlApp as "New" you could define it simply as Excel.Application

Then in your code Set xlApp as New Excel.Application
Then Set wb as xlApp...

But as long as it works, and the instance is closed, you're probably ok
 
http://www.access-programmers.co.uk/forums/showthread.php?t=265778
You got some great assistance there!
This is the third Access code using Excel posted today.
For the future, I am strongly suggesting that each of you beginners follow the steps above and add error trapping code.
Also, please set a break point and learn how to single step through the code.

This will help many others serve you better.
Great job on your coding! This small tip will just make for better and more complex code. Error trapping and stepping through code will help identify any issue much faster.

Please mark the thread as SOLVED once it reaches a conclusion.
 

Users who are viewing this thread

Back
Top Bottom