Solved

Cleaning HD of consequences of VBA application object errors

Posted on 2013-05-25
6
550 Views
Last Modified: 2013-05-26
I'm learning to create Application interactions between MS Visio and Excel in early binding. When I started  creating application objects (visio, excel) I did not clean up the objects before closing, and Windows7 showed down a lot. Then I learned to clean up application objects before closing, eg in Visio code and for excel.application:
if NOT xlApp is Nothing then Set xlApp = Nothing

if Visio code creates xl.App and throws a bug before xl.App is cleaned up, does this adversely affect Windows7?

ought one to have
if NOT xlApp is Nothing then Set xlApp = Nothing in a beforeClose event in the visio ThisDocument module?

Finally, how does one maintain ones HD / Windows7 when these coding mistakes are made, and xlApp is not killed.

I try running the PC through Windows7 safe mode once or twice, and if that does not help speed up excel/visio, do a system restore to a restore point at which Windows was running faster.

What SHOULD I do?

Are there 'cleaning processes' I should use regularly in this connection?

Thanks
Kelvin
0
Comment
Question by:Kelvin4
6 Comments
 
LVL 17

Accepted Solution

by:
andrewssd3 earned 260 total points
ID: 39197597
This situation should not cause any lasting issues to your HD after a log-off log-on or a restart of the computer.  What does happen is that during one session you could get a lot of instances of Excel hanging around in the background using up resources.  You should be able to see these if you start Task Manager and look on the Processes tab. You can also kill them from here.  However they will go away after you log off.

The only permanent effect I could imagine is that starting Excel could become slow as it will warn you about lots of files needing recovery when you start anew session.

As you say it is definitely recommended to kill the instances when you are finished with them.  It is best to close any unsaved files, and use the xlApp.Quit method to ensure it goes away before setting to nothing.

You should also use error handling to ensure you do the close even if an error is raised.

For a comprehensive discussion (which may be over the top for your requirements), see this EE article http://rdsrc.us/TVnIgG
0
 
LVL 19

Assisted Solution

by:Ken Butters
Ken Butters earned 80 total points
ID: 39197603
I agree with andrewssd3.  In general the items you are referring to are more memory management issues than they are hard drive management issues.

You can however use a tool like http://www.piriform.com/ccleaner to clean up leftover files from various places on your hard drive.
0
 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 80 total points
ID: 39197608
I have two suggestion 1) Ask that this question be moved to the coding section for experts there and 2) to use tools like CCleaner and glary utilities--these will address ystem issues and not coding issues. Hope that helps
http://www.piriform.com/ccleaner/download
http://www.glarysoft.com/glary-utilities/download/
0
 
LVL 69

Assisted Solution

by:Qlemo
Qlemo earned 80 total points
ID: 39197667
"Run in safe mode" and "performing a system restore" are in no way related to your application objects. As said by prior posts, the application objects are bound to the session, in memory, and cannot persist over a reboot or log-off.

IMHO the only issues you can get rid of with a system restore is
a) MRU list (most recently used files)
b) crash/file recovery info for Visio/Excel, as mentioned above.
The latter is usually fixed by starting the corresponding application once without any file, or with the file not closed properly.
0
 

Author Closing Comment

by:Kelvin4
ID: 39198022
Thank you all for useful education
Kelvin
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

828 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