AVAYA CMS Scripting through Excel VBA
Private Function CMSGetReport( _
sServerIP As String, _
iACD As Integer, _
sReportName As String, _
sProperty1Name As String, _
sProperty1Value As String, _
sProperty2Name As String, _
sProperty2Value As String, _
sExportName As String) As Boolean
Const Username As String = "india"
Const Password As String = "mumbai11"
Dim cvsApp As Object
Dim cvsConn As Object
Dim cvsSrv As Object
Dim Rep As Object
Dim Info As Object, Log As Object, b As Object
Set cvsApp = CreateObject("CVS.cvsApplication")
Set cvsConn = CreateObject("CVSCN.cvsConnection")
Set cvsSrv = CreateObject("CVSUPSRV.cvsServer")
Set Rep = CreateObject("CVSREP.cvsReport")
'Set cvsApp = New CVSUP.cvsApplication
If cvsApp.CreateServer(Username, "", "", sServerIP, False, "ENU",
cvsSrv, cvsConn) Then
If cvsConn.Login(Username, Password, sServerIP, "ENU") Then
CMSGetReport = False
On Error Resume Next
cvsSrv.Reports.ACD = iACD
Set Info = cvsSrv.Reports.Reports(sReportName)
If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The Report " & sReportName & " was not found on
ACD" & iACD & ".", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("CVSERR.cvslog")
Log.AutoLogWrite "The Report " & sReportName & " was not
found on ACD" & iACD & "."
Set Log = Nothing
End If
Else
b = cvsSrv.Reports.CreateReport(Info, Rep)
If b Then
Debug.Print Rep.SetProperty(sProperty1Name,
sProperty1Value)
Debug.Print Rep.SetProperty(sProperty2Name,
sProperty2Value)
' Debug.Print Rep.SetProperty(sProperty3Name,
sProperty3Value)
b = Rep.ExportData(sExportName, 9, 0, True, False, True)
Rep.Quit
CMSGetReport = True
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove
Rep.TaskID
Set Rep = Nothing
End If
End If
Set Info = Nothing
End If
End If
End Function
Sub b()
Call CMSGetReport("172.18.3.60", 1, "Upstream Stats Rpt", "Date(s)",
"03/01/06--1", "Split Numbers", "71;72;74;79;82;83",
"m:\ReportsAutomation\abc.xls")
End Sub
The code I posted earlier is changed. Above is the new code helped by
user Right_Click @ mrexcel.com forum.
The problem now is:
Run-time error '429':
ActiveX componenet can't create object
line: Set cvsApp = CreateObject("CVS.cvsApplication")
Looks like I haven't set the right references.
I went to Tools-References and selected the checked CVS Application
Component and the location it is poiting out is c:\Program
Files\Avaya\CentreVu Supervisor 9.0\cvsAPP.exe which is correct.
Then what I did was, went through all the controls in the references
window and checked all of them that were pointing to c:\Program
Files\Avaya\CentreVu Supervisor 9.0\ directory but still the same
error.
What am I doing wrong?
|