Hello,
it would be nice, if someone could give me some advice: 1. I'm trying to automate Spss 20 from Excel-VBA. These references are set: C:\Program Files\Common Files\IBM\SPSS\COM\spsswin.tlb C:\Program Files\Common Files\IBM\SPSS\COM\spsswin.dll My environment: Windows 7, Excel 2003/ Excel 2010 64bit My Code to invoke Spss: '### Private spssApp As spsswin.Application Sub Test() Set spssApp = CreateObject("", "spsswin.Application16") End Sub '### I always get an Error Message: "ActiveX componente can't create object" (Err 429) That happens in Excel 2003 and 2010 (64) Whats wrong with it? 2. If I try to code in the winwrap-IDE in spss itself, I don't see any spss-specific entries in the object-catalog. The Script-Editor seems to has lost his reference to spss - no intellisense, no recognizing of spss-objects. What should I do? 3. I'm aware, that python could be an alternative. But that would be a new language for me. I'm hesitating because it seems the python-plugin is based on v2.8 - and I don't want to learn something obsolete in the first place. My questions: Does the plugin work wit python 3.x too? Are there any good reasons to begin with an older version of python? Any help appreciated. Thanks. Chris Drontheim Berlin |
Administrator
|
I don't recall there being 2 parameters for CreateObject.
GetObject Yes! Does the following work? -- Sub Test() Set spssApp = CreateObject("spsswin.Application16") End Sub
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Hello David,
thank you for reply. But that doesn't solved it. I've gambled with GETobject before and I've forgot to delete the second parameter, sry... Sadly, the right syntax is not the solution. Btw.: No luck with getobjects and a running instance of spss. Any other ideas? |
Administrator
|
Hi Chris,
It appears you have declared the object incorrectly: You have: Private spssApp As spsswin.Application Should be Private objSpssApp As spsswinLib.Application16 Hopefully this helps. I am on my Mac so can't verify for you. David --- From page 411 of http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=8&ved=0CGAQFjAH&url=http%3A%2F%2Flibrary.uvm.edu%2Fservices%2Fstatistics%2FSPSS20Manuals%2FIBM_SPSS_Statistics_Core_System_User_Guide.pdf&ei=Oei7Tpu-KeHf0QH13P3eCQ&usg=AFQjCNHWyvLVwg3MzjxyiEUWI1C9fduGqQ : That URL might be screwy, so Google CreateObject SPSS 20 and go halfway down (8th entry in my search). "Using External COM Clients For version 16.0 and above, the program identifier for instantiating SPSS Statistics from an external COM client is SPSS.Application16. Application objects should be declared as spsswinLib.Application16. For example: Dim objSpssApp As spsswinLib.Application16 Set objSpssApp=CreateObject("SPSS.Application16") To connect to a running instance of the SPSS Statistics client from an external COM client, use: Dim objSpssApp As spsswinLib.Application16 Set objSpssApp=GetObject("","SPSS.Application16") If more than one client is running, GetObject will connect to the most recently launched one. Note: For post-16.0 versions, the identifier is still Application16. " -----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Hi David,
thanks, it looks like a step forward, but it's still unsolved. The symptoms: When I type spsswinLib then there are three possible sub-objects, e.g. "ISpssIGraph16", but no "Application16" entry. If i ignore it, then there is Error 429 again. Do I need a third reference to a dll, that represents the "application16"-object. Which one? Merkwürdig. I appreciate your help very much. Thanks for guiding me to the pdf-manual Chris |
Administrator
|
Not sure, don't have any recent version installed. One thought: Do a search for SPSS*.tlb and see what other type libs are present for SPSS. Do any others show up under Excel's ?components/reference? dialog
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Hi David,
I've set references to spssgclt.tlb spsspvt.tlb spssrtf.tlb spssein.tlb treeview.tlb vischart.tlb there are no other tlb's belonging to spss on my system. Thank you very much. Best Chris Drontheim |
In reply to this post by cd1001
Hi, Ad 3: "Does the plugin work wit python 3.x too? Are there any good reasons to begin with an older version of python?" No and yes, respectively. The differences between Python 2.x and 3.x are not that big (http://docs.python.org/release/3.0.1/whatsnew/3.0.html). Compare this to VBA/Sax Basic and VB .NET. One reason to stick with 2.x for a while is that not many tutorials and sample code is yet available for Python 3. What does the program you are talking about do? Apparently it fires up Spss from within Excel, and then you probably want to do some calculation and slurp the result back into Excel, right? You could also use the spss Python api and the xlwt module to write spss results to an xls file. If you're brave you can also use COM calls using win32com.client. By the way, are you aware of RExcel? It makes it possible to use R functions from within Excel, using COM calls behind the scenes: http://rcom.univie.ac.at/ Cheers!! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
In reply to this post by cd1001
If you have a reasonably recent version
of Statistics, you should have a reference to the SPSS Statistics Type
library, which is normally in
\program files\common files\ibm\spss\com\spsswin.dll. The exact location has moved around a bit due to the IBM acquisition. You should see the SPSS libraries listed under Tools>References or similar if they are properly set up. There might also be issues if you are mixing 32-bit Office with 64-bit Statistics. If the files are not around, you may need to reinstall or, more likely to force the dlls to register. regsrvr32 is a Microsoft tool for this. There are some technical issues that sometimes cause the normal registration to fail. HTH, Jon Peck (no "h") Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: cd1001 <[hidden email]> To: [hidden email] Date: 11/10/2011 11:18 AM Subject: Re: [SPSSX-L] v20 Programming-Setup/ external, Sax-Basic, Python Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi David, I've set references to spssgclt.tlb spsspvt.tlb spssrtf.tlb spssein.tlb treeview.tlb vischart.tlb there are no other tlb's belonging to spss on my system. Thank you very much. Best Chris Drontheim -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/v20-Programming-Setup-external-Sax-Basic-Python-tp4980953p4981920.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Albert-Jan Roskam
Hi Albert-Jan,
you are right with your guess regarding my work-flow-scenario. Thank you for pointing me to RExcel. Looks promising. I will try this route. Thanks and viele Grüße. |
Free forum by Nabble | Edit this page |