Hello
I have a marco in excel allowing me to modify a solidworks file.
However, I would like to know how to completely close solidworks with my excel macro?
I manage to close my file but solidworks remains open...
Does anyone have a solution?
Hello
I have a marco in excel allowing me to modify a solidworks file.
However, I would like to know how to completely close solidworks with my excel macro?
I manage to close my file but solidworks remains open...
Does anyone have a solution?
Hello
Here is a piece of code that should answer this question:
'closes solidworks
Sub DeactivateSolidWorks()
On Error Resume Next
swApp.ExitApp
'Try to Activate Solidworks, however, it always appears that the while loop is never entered
Set swApp = GetObject(, "SldWorks.Application")
'wait until solidworks has ended
Do While Err.Number = 0
Set swApp = GetObject(, "SldWorks.Application")
Loop
'***note I have also tried. this seems to make the situation worse some how
'Application.Wait Now + TimeValue("00:00:10")
End Sub
Spring:
https://forum.solidworks.com/thread/56449
Hello
by code look at the API
Otherwise it is also possible to kill the process (it's a bit less clean but radical)
Either by the tools of the frameWorks Process
Let us run a . Bat Container
taskkill /f /im sldworks.exe /t
taskkill /f /im solidworkslicensing.exe /t
taskkill /f /im solidworkslictemp.0001 /t
taskkill /f /im sldexitapp.exe /t
taskkill /f /im sldimscheduler.exe /t
taskkill /f /im sldboengine /t
As much for me, a priori the first answer does not work, see here:
http://www.taltech.com/support/entry/opening_and_closing_an_application_from_vba
Or here:
http://www.excel-downloads.com/forum/183603-fermer-un-programme-en-vba-avant-autre-choix.html
Or radical method:
Shell "taskkill /f /im solidworks.exe", vbHide
Thank you for your answers so fast.
Hello
My answer is a bit out of the Excel context. But it can be useful to other users. To make sure you close SolidWorks cleanly, after a crash for example, you can run this bat file.
Kind regards