Run time error 429 - ActiveX component can't create object.
Hi ,
I am trying to execute the SAS through Excel VBA 2016 , and I am getting an error : 429 - ActiveX component can't create object.
It worked in excel 2010 , could anyone help me.
Code:
Sub ExecuteSascmd()
Dim app
Dim prjObject
Dim codeObj
Dim prjName
Dim codeFile
Dim logFile
Dim sSASCmd
Dim fileSys, fReadStream, fileString
Dim profile As String
Dim i As Integer
Application.StatusBar = "Executing sas script at sever. Please wait....."
sSASCmd = sSASCmd & "%include'" & sampath & "/scripts/" & sasExecutable & "';"
sSASCmd = sSASCmd & "ENDSAS;"
Set app = CreateObject("SASEGObjectModel.Application.5.1")
app.SetActiveProfile (sasEG_profile)
Set prjObject = app.New()
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set codeObj = prjObject.CodeCollection.Add
codeObj.Server = codeServer
codeObj.Text = sSASCmd
Application.DisplayAlerts = False
codeObj.Run
Application.DisplayAlerts = True
Application.StatusBar = "Data is uploaded to the server"
End Sub