Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

"Processing" indicator while running macro

Status
Not open for further replies.

Milothicus

Mechanical
Sep 21, 2003
39
0
0
CA
I've made a macro to do some manipulation of BOM information that can take about a minute to run, depending on assembly size. while it's working in the background, there's no way to tell if it's working, or if it's crashed completely.

is there any way to show a status bar or even a form that says "Processing" or something along those lines while the code is running? I tried making a form, but showing the form stops the code until the user clicks on 'ok'.

any recommendations?
 
Replies continue below

Recommended for you

Can you see the process running in the Task Manager?

[cheers]
Making the best use of this Forum. faq559-716
How to get answers to your SW questions. faq559-1091
Helpful SW websites every user should be aware of. faq559-520
 
I can see it in the task manager, because the macro copies BOM info into a new Excel window and processes it there, but unfortunately i'm also having problems getting it to clear out of the task manager when it's finished.

i'll take a look at that progress meter, and see if i can get something out of that...
 
well, i didn't bother with the bar changing size, but i do now have a progress form.

before i couldn't get the code to keep running while the form was open... i was missing the option of using the form's activation event to trigger the rest of the code.

thanks for the help.
 
You can simply have MsgBoxes, in critical locations of your code, informing about the running stage (or the stage that was finished).

In the end of the macro you can have another MsgBox informing that the macro was successfuly completed.

Regards
 
Completing my last mail, I think you can configure the MsgBox so it don't ask you to click OK.

The last one should have an OK to click.

Regards
 
When I program, I almost always make a "monitor form". I trigger the form with a boolean flag that acts to activate "debug mode". I also add "kill buttons" that are visible in debug mode.

Make sure the form is non-modal. Put a timer on the form. Use the timer to trigger reading of key variables and updating of information on your form.
 
You may already do this. Unload Me removes the exe from task manager. In my cmdExit button I put in the following:

Private Sub cmdExit_Click()
Set swApp = CreateObject("SldWorks.Application") ' attach to SolidWorks
Set Part = swApp.ActiveDoc ' get the PartDoc for the current Part
Set swApp = Nothing
Set Model = Nothing
Set drawing = Nothing
Set DwgDoc = Nothing
Set Part = Nothing
Unload frmSfInfo
Unload Me
End
End Sub


Bradley
 
The problem i'm having with task manager is actually my excel instance...

i've gone through the code to make sure that all objects have been set to nothing, and all documents closed, but it still seems to stay in memory... maybe i missed something...
 
Yes, I have had that happen several times with my Visual Basic programs. Don’t remember how I fixed it. I do the standard things, like reboot, recreate the exe and etc. I am almost sure it is not within the code for me, because it always worked the day before.

Bradley
 
Try using the Quit method on the Excel Application object to end Excel. First check if other workbooks are open. Also, make sure to close the workbook generated by your SW BOM editing.
 
Are you using VB or VB.NET? If you use VB.NET, you need to make sure you use ReleaseCOMObject to allow .NET to run garbage collection on Excel.

Evan T. Basalik, MCSD
--------------------------------
It's all about prioritization...
 
first, i set the worksheet pointers to Nothing, then set the WB.saved = True (to avoid save confirmation when closing), close the workbook, set that to Nothing, then xlapp.quit, set that to Nothing, then go through the SW references i've created doing the same...

i'm not clear on the different versions of VB, really. according to the 'about MS VB' page, it's VB 6.3, VBA: Retail 6.4.9972, forms3 11.0.6254

TheTick Wrote:
Also, make sure to close the workbook generated by your SW BOM editing.

not sure what you're referring to. my BOM is SW-table based, and i'm copying from that into just one workbook, which i'm closing properly (as far as i know)
 
Status
Not open for further replies.
Back
Top