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

Can't open Excel file after running VB program

waynetheengineer
P: 26
Hi everyone,

I have a program that opens an Excel file, reads data from it, then closes the open workbook. But when I exit my program and go to edit that Excel file, it won't let me open it. When I double click it, the screen blinks for a fraction fo second but nothing opens. I have a suspicion that VB isn't properly closing the Excel file, eventhough I put the following statement at the end of my code:

Expand|Select|Wrap|Line Numbers
  1. ApExcel.ActiveWorkbook.Close, "C:\File.xls"
Any suggestions?
Thanks :)

Wayne.
Apr 10 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
This same problem was reported here recently, and I think the answer was to properly release all the references to Excel objects (you know, things like Set ... = Nothing). Try a search, using the search box at top-right.
Apr 10 '07 #2

iburyak
Expert 100+
P: 1,017
Hi everyone,

I have a program that opens an Excel file, reads data from it, then closes the open workbook. But when I exit my program and go to edit that Excel file, it won't let me open it. When I double click it, the screen blinks for a fraction fo second but nothing opens. I have a suspicion that VB isn't properly closing the Excel file, eventhough I put the following statement at the end of my code:

Expand|Select|Wrap|Line Numbers
  1. ApExcel.ActiveWorkbook.Close, "C:\File.xls"
Any suggestions?
Thanks :)

Wayne.
This should work:

[PHP]ApExcel.ActiveWorkbook.Close, "C:\File.xls"
ApExcel.Quit[/PHP]

Good Luck.
Apr 10 '07 #3

waynetheengineer
P: 26
The .Quit command works perfectly. Thank you very very very much! :) Case closed.

Wayne.

This should work:

[PHP]ApExcel.ActiveWorkbook.Close, "C:\File.xls"
ApExcel.Quit[/PHP]

Good Luck.
Apr 10 '07 #4

Expert 5K+
P: 8,434
The .Quit command works perfectly. Thank you very very very much! :) Case closed.
Thanks for that, iburyak. I remember seeing this stuff recently, but I'm often too busy to go searching.

Glad we could help, Wayne.
Apr 10 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.