Hello,
If anyone is interested, I found what I need in another forum (I forgot to keep the link for reference, sorry).
The main idea is to open the project in background without running it, defining the parameters and the run it.
My code now look like that :
Option Explicit
Dim app ' As SASEGuide.Application
Dim j ' as integer
Dim m ' as integer
Dim a ' as integer
j = InputBox("Jour")
m = InputBox("Mois")
a = InputBox("Année")
Call dowork(j, m, a)
'shut down the app
If Not (app Is Nothing) Then
app.Quit
Set app = Nothing
End If
Sub dowork(j, m, a)
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
Dim parmList
Dim parm
Dim parm2
Dim parm3
prjName = "\\myfolder\myfile.egp" ' Project 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
'---
' discover the parameters
'---
Set parmList = prjObject.Parameters
WScript.Echo "Project has " & parmList.count & " parameters."
' work with the first parameter
Set parm = parmList.Item(0)
' WScript.Echo parm.Name & " parameter has default value of " & parm.DefaultValue
parm.Value = m
' WScript.Echo parm.Name & " parameter has been set to value of " & parm.Value
' work with the second parameter
Set parm2 = parmList.Item(1)
' WScript.Echo parm2.Name & " parameter has default value of " & parm2.DefaultValue
parm2.Value = a
' WScript.Echo parm2.Name & " parameter has been set to value of " & parm2.Value
' work with the third parameter
Set parm3 = parmList.Item(2)
' WScript.Echo parm3.Name & " parameter has default value of " & parm3.DefaultValue
parm3.Value = j
' WScript.Echo parm3.Name & " parameter has been set to value of " & parm3.Value
'---------
' run the project
'---------
prjObject.Run
' WScript.Echo parm.Name & " parameter has been set after Run to value of " & parm.Value
' WScript.Echo parm2.Name & " parameter has been set after Run to value of " & parm2.Value
' WScript.Echo parm3.Name & " parameter has been set after Run to value of " & parm3.Value
prjObject.Close
app.Quit
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