BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I want to run a procedure with a vbscript. Sas is able to generate the code to run it but my procedure contains parameters that are prompted when the proc is runned manually (these parameters are needed in some queries).

Unfortunatly when the script runs, the parameters are not prompt.
I can prompt informations from the script but I don't know how to run the procedure with this informations as parameters for the procedure.

Here is my code :

Option Explicit
Dim app ' As SASEGuide.Application
dim a ' as integer
dim b ' as integer
dim c ' as integer

a= InputBox("Jour")
b= InputBox("Mois")
c= InputBox("Année")


Call dowork (a,b,c)

'shut down the app
If not (app Is Nothing) Then
app.Quit
Set app = Nothing
End If


Sub dowork(a,b,c)
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----
Dim prjName ' As String
Dim prjObject ' As SASEGuide.Project
Dim containerName ' As String
Dim containerObject ' As SASEGuide.Container
Dim containerColl ' As SASEGuide.ContainerCollection
Dim annee ' As integer
Dim mois' As integer
Dim jour' As integer


prjName = "\\xxxxxxxxx.egp" ' Project Name
containerName = "Flux de processus" ' Container Name

Set app = CreateObject("SASEGObjectModel.Application.4")
If Checkerror("CreateObject") = True Then
Exit Sub
End If

Set prjObject = app.Open(prjName,"")
If Checkerror("App.Open") = True Then
Exit Sub
End If


'-----
'Get The Container Collection and Object
'-----
Set containerColl = prjObject.ContainerCollection
If Checkerror("Project.ContainerCollection") = True Then
Exit Sub
End If

Dim i ' As Long
Dim count ' As Long
count = containerColl.count
For i = 0 To count
Set containerObject = containerColl.Item(i)
If Checkerror("ContainerCollection.Item") = True Then
Exit Sub
End If

If (containerObject.Name = containerName) Then
Exit For
Else
Set containerObject = Nothing
End If

Next

If not (containerObject Is Nothing) Then
'----
' Run the Container
'----
containerObject.Run
If Checkerror("Container.Run") = True Then
Exit Sub
End If
End If

'-----
' Save the new project
'-----
prjObject.Save
If Checkerror("Project.Save") = True Then
Exit Sub
End If

'-----
' Close the project
'-----
prjObject.Close
If Checkerror("Project.Close") = True Then
Exit Sub
End If

End Sub

Function Checkerror(fnName)
Checkerror = False

Dim strmsg ' As String
Dim errNum ' As Long

If Err.Number <> 0 Then
strmsg = "Error #" & Hex(Err.Number) & vbCrLf & "In Function " & fnName & vbCrLf & Err.Description
'MsgBox strmsg 'Uncomment this line if you want to be notified via MessageBox of Errors in the script.
Checkerror = True
End If

End Function




Thank you for your help

Georges
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
It looks like SAS Enterprise Guide or an EG Project is involved in this VBScript. You might want to post this question in the EG Forum, since most of the folks who use VB and EG and the main developer who knows about automation with VB and .NET hang out over there.

cynthia
deleted_user
Not applicable
Thanks,

I'll do it right away

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1213 views
  • 0 likes
  • 2 in conversation