?
Solved

VB 5 & MS Excel 97 - Process not releasing (Part 2)

Posted on 2004-11-23
6
Medium Priority
?
167 Views
Last Modified: 2010-05-02
Folks,

For those not already familiar this relates to my previous questions yesterday "VB 5 & MS Excel 97 - Process not releasing".

I am just going to follow on from there.

I think that I have identified why the Excel Process is not releasing but as of yet can not find a solution.

The code works fine if you open an Excel File, Save it and Close.

The Problem is introduced when you perform some formatting and layout changes to the Excel File.

As I am converting a CSV file to XLS and performming formatting and layout changes I get the Message box on saving notifying that this CSV was saved in a previsous version of excel - Do you want to save in 97, so on.

The problem is that I have yet not seen a way to answer yes to this and this seems to be what keeps the Excel process open.

If you leave DisplayAlerts = True and try modify a file of this format you will get the message box I am talking about and the Excel process should not release after you have set xlApp = nothing.


Any ideas on this one guys?

Thanks in advance for any help!  It is very much appreciated as always!

Ed
0
Comment
Question by:Elmo_
  • 3
  • 3
6 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 1080 total points
ID: 12652626
When you save, are you specifying the second (file format) parameter? I think that, if you do, then Excel will not have to ask you?

If you don't want to save, you can set the Workbook property .Saved to true.
0
 
LVL 3

Author Comment

by:Elmo_
ID: 12652772
GrahamSkan,

Thanks for the prompt response:  The Save that I use is as follows:

    loExcel_Book.SaveAs psSave_To_Loc & lsSave_File_Name, xlExcel4Workbook


Excel does not ask for the new file format when this is specified.  If you perform no formatting or changes to the file this saves fine as [Filename].xls.  If you the open this XLS file make a formatting change and try to save you get:

[FileName] was created in a previous version of Microsft Excel.  Do you want to update it to the new format?

To update it click yes.
To Save it in the existing format, click no. Some types of changes may be lost.

Any ideas
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12653123
Just to be sure that you've considered the question, do you really need to save is as Excel 4?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Elmo_
ID: 12653191
GrahamSkan,

Cheers for that - I am looking at it now and will get back to you.  I did not notice that the save is Excel4 instead of the normal!

Hopefully I will revert soon with good news.
0
 
LVL 3

Author Comment

by:Elmo_
ID: 12673840
GS,

Sorry that I only gave you a B - But I could not give you full marks as it was not exactly the solution I was looking for but it did help.

Cheers,

Ed.

*********

Just to note.

I finally got this working.

I farmed out the code to a new vb app which initially loads Sub Main.

The excel instance gets createded, generates the report and saves.  When sub main is finished it automatically terminates the app - There by also killing the associated Excel Process which previously would not close.

I then shell this from my main app and everything works fine!

Thanks for all the help!

Ed.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12674051
Great. Thanks for the update
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question