-
Aug 15th, 2022, 10:22 PM
#1
Thread Starter
Registered User
completely quit the created object in VBA excel
Hi there.,
I'm doing a code for running Syntax of SPSS
by creating SPSS object in VBA excel -> run SPSS Syntax -> close SPSS object -> run next SPSS Syntax
so far, it can run the first Spss Syntax (*.sps file) very smoothly.
But the code seems not working well. It didn't close(quit) completely SPSS object.
and It can not run the second Spss'Syntax (the next *.sps file)
Is there any idea for my case?
How could completely close/quit/dispose SPSS created object?
Any idea is appreciated
Thank in advance.
Code:
Sub runspsssyntax()
Dim i As Integer, link As String
Dim SPSS As spsswin.Application
For i = 0 To 40
link = "C:\Users\" & i & ".sps"
Set SPSS = GetObject(, "SPSS.Application")
SPSS.ExecuteInsert FileName:=link, syntaxBatch:=True, errorStop:=False, cd:=True, Sync:=True
SPSS.Quit
Set SPSS = Nothing
Next i
End Sub
-
Aug 17th, 2022, 02:35 AM
#2
Thread Starter
Registered User
Re: completely quit the created object in VBA excel
Is there any idea for me, please?
Thanks
-
Aug 17th, 2022, 05:22 AM
#3
Re: completely quit the created object in VBA excel
Why are you Creating and quitting inside the loop?
Untested
Code:
Sub runspsssyntax()
Dim i As Integer, link As String
Dim SPSS As spsswin.Application
Set SPSS = GetObject(, "SPSS.Application")
For i = 0 To 40
link = "C:\Users\" & i & ".sps"
SPSS.ExecuteInsert FileName:=link, syntaxBatch:=True, errorStop:=False, cd:=True, Sync:=True
Next i
SPSS.Quit
Set SPSS = Nothing
End Sub
What baffles me completely:
You have those scripts in "c:\Users"????
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Aug 17th, 2022, 12:05 PM
#4
Hyperactive Member
Re: completely quit the created object in VBA excel
I'm guessing you'd have better luck with IBM support than here.
-
Aug 17th, 2022, 11:10 PM
#5
Thread Starter
Registered User
Re: completely quit the created object in VBA excel
Originally Posted by Zvoni
Why are you Creating and quitting inside the loop?
Untested
I think that VBA excel will call SPSS Object then
run SPSS Syntax -> close SPSS object -> call new SPSS object -> run next SPSS Syntax -> so on...
Because I already have SPSS syntaxes,
normally I open SPSS application, open SPSS syntax, Ctrl + A that syntax, Ctrl + R to run that Syntax.
SPSS application would give me what I want. THEN close SPSS. Perform steps over and over again.
so far, I have 20 -> 100 syntaxes and more than, it really takes time to perform one by one by mormally.
What baffles me completely:
You have those scripts in "c:\Users"????
the completely address will be: "C:\Users\admin\Desktop\gst regis\example001.sps"
with example001.sps is model number 001
Thanks
-
Aug 17th, 2022, 11:13 PM
#6
Thread Starter
Registered User
Re: completely quit the created object in VBA excel
is it possible if we use "Application.sendkeys" for VBA sendkeys to objects to Quit it-self?
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|