Hi,
I'm using VBA to run a syntax-command in SPSS.
This is working just fine in Excel 2007, in Excel 2013 however it is not working.
This is the code I use in Excel 2007:
syntaxtext1="freq q1." 'only an example
Set ObjSpssApp = GetObject(, "Spss.Application")
On Error Resume Next
' **** if I want to create a new Output Document:
If Cells(34, 7).Value = "yes" Then
Set ObjOutputDoc = ObjSpssApp.NewOutputDoc
End If
ObjOutputDoc.Visible = True
ObjOutputDoc.Designated = True
'Application.Wait (Now + TimeValue("0:00:01"))
StrCommand = syntaxtext1
Application.DisplayAlerts = False
'Application.Wait (Now + TimeValue("0:00:01"))
ObjSpssApp.Alerts = False
' ***** run command in SPSS
ObjSpssApp.ExecuteCommands StrCommand, True
ObjSpssApp.Alerts = True
Application.DisplayAlerts = True
ObjOutputDoc.PromptToSave = True
Dim OutputName As String
Set ObjOutputDoc = ObjSpssApp.GetDesignatedOutputDoc
The macro is written to automatically create spss-commands (which are much more difficult than the example here) and then automatically run them in SPSS. As I said; this is working just fine with Excel 2007, just not with Excel 2013.
Does anybody has any idea, why this isn't working in Excel 2013 (and what i must do to make it work)?
Thanks a lot in advance!
P.S.: Sry for my bad english; I'm not a native Speaker...
I'm using VBA to run a syntax-command in SPSS.
This is working just fine in Excel 2007, in Excel 2013 however it is not working.
This is the code I use in Excel 2007:
syntaxtext1="freq q1." 'only an example
Set ObjSpssApp = GetObject(, "Spss.Application")
On Error Resume Next
' **** if I want to create a new Output Document:
If Cells(34, 7).Value = "yes" Then
Set ObjOutputDoc = ObjSpssApp.NewOutputDoc
End If
ObjOutputDoc.Visible = True
ObjOutputDoc.Designated = True
'Application.Wait (Now + TimeValue("0:00:01"))
StrCommand = syntaxtext1
Application.DisplayAlerts = False
'Application.Wait (Now + TimeValue("0:00:01"))
ObjSpssApp.Alerts = False
' ***** run command in SPSS
ObjSpssApp.ExecuteCommands StrCommand, True
ObjSpssApp.Alerts = True
Application.DisplayAlerts = True
ObjOutputDoc.PromptToSave = True
Dim OutputName As String
Set ObjOutputDoc = ObjSpssApp.GetDesignatedOutputDoc
The macro is written to automatically create spss-commands (which are much more difficult than the example here) and then automatically run them in SPSS. As I said; this is working just fine with Excel 2007, just not with Excel 2013.
Does anybody has any idea, why this isn't working in Excel 2013 (and what i must do to make it work)?
Thanks a lot in advance!
P.S.: Sry for my bad english; I'm not a native Speaker...