Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question Avaya loginout CMS1

  • williamrgre
  • Topic Author
  • Visitor
  • Visitor
9 years 2 months ago #482 by williamrgre
Avaya loginout CMS1 was created by williamrgre
I recently dowloaded the Avaya loginout CMS1 macro, which is a great product. However, each time I run the macro I recieve the Run-Time error '5' Invalid procedure call or argument near the end of the code. Highlighted red text in code below is where I am recieving this error message. Any assistance is welcome.

Sub CMSGetReport()


Dim lwbk As Workbook
Dim lws As Worksheet

Application.ScreenUpdating = 0

'On Error GoTo errhandle



Set lwbk = ThisWorkbook
Set lws = lwbk.Sheets("Results")

lws.Range("a1:e65536").ClearContents
UserName = ThisWorkbook.Sheets("Panel").Range("c7").Text
Password1 = ThisWorkbook.Sheets("Panel").Range("c8").Text
CMSServer = ThisWorkbook.Sheets("Panel").Range("c9").Text



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("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvsSrv = CreateObject("ACSUPSRV.cvsServer")
Set Rep = CreateObject("ACSREP.cvsReport")

If cvsApp.CreateServer(UserName, "", "", CMSServer, False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login(UserName, Password1, CMSServer, "ENU") Then
On Error Resume Next
For a = lwbk.Sheets(2).Range("b2") To lwbk.Sheets(2).Range("d2")

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\Agent\Login/Logout (Skill)")
If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\Agent\Login/Logout (Skill) was not found on ACD 1.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("ACSERR.cvsLog")
Log.AutoLogWrite "The report Historical\Agent\Login/Logout (Skill) was not found on ACD 1."
Set Log = Nothing
End If
Else
b = cvsSrv.Reports.CreateReport(Info, Rep)
If b Then
Rep.SetProperty "Skill", ThisWorkbook.Sheets("Panel").Cells(2, 6).Text
Rep.SetProperty "Date", a
b = Rep.ExportData("", 9, 0, True, True, False)
Rep.Quit
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

lws.Activate

'Find next empty row
lrow = lws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0).Row
lws.Paste Destination:=lws.Cells(lrow, 1)
ndate = Format(CDate(lws.Cells(lrow, 2)), "mm/dd/yyyy")
lws.Cells(lrow, 2) = CDate(ndate)
lrow = lrow + 3
Do Until lws.Cells(lrow, 7) = ""
lws.Cells(lrow, 7) = CDate(ndate)
lrow = lrow + 1
Loop
End If
Next
End If
End If


Set Log = Nothing
Set Rep = Nothing
Set cvsSrv = Nothing
Set cvsConn = Nothing
Set cvsApp = Nothing



lws.Activate
'Format Cells
lws.Columns("H:W").Delete Shift:=xlLeft
lws.Columns("B:B").Insert
lws.Columns("H:H").Cut Destination:=lws.Columns("B:B")
lws.Columns("F:F").Delete Shift:=xlLeft
lws.Columns("C:D").Delete Shift:=xlLeft

lws.Rows("1:5").Delete Shift:=xlUp

irow = 1
lr = ThisWorkbook.Sheets("Results").Range("a65536").End(xlUp).Row
For irow = 1 To lr
If lws.Cells(irow, 2) = "" Or lws.Cells(irow, 1) = "Agent Name" Then
lws.Rows(irow).ClearContents
End If
Next
lrow = lws.Cells(Rows.Count, 1).End(xlUp).Row
lws.Range(lws.Cells(1, 1), lws.Cells(lrow, 4)).Sort Key1:=lws.Range("A1"), Order1:=xlAscending, Key2:=lws.Range("B1"), Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

irow = 1
Do Until lws.Cells(irow, 3) = "" And lws.Cells(irow + 1, 3) = ""
If lws.Cells(irow, 1) = lws.Cells(irow + 1, 1) And lws.Cells(irow, 2) = lws.Cells(irow + 1, 2) Then
lws.Cells(irow, 4) = lws.Cells(irow + 1, 4)
lws.Rows(irow + 1).Delete Shift:=xlUp
irow = irow - 1
End If
irow = irow + 1
Loop
lrow = lws.Cells(Rows.Count, 1).End(xlUp).Row

For irow = 1 To lrow
lws.Cells(irow, 3) = Mid(lws.Cells(irow, 3), 1, Len(lws.Cells(irow, 3)) - 2) & " " & Right(lws.Cells(irow, 3), 2)
lws.Cells(irow, 4) = Mid(lws.Cells(irow, 4), 1, Len(lws.Cells(irow, 4)) - 2) & " " & Right(lws.Cells(irow, 4), 2)

Next

lws.Columns("a:d").EntireColumn.AutoFit
Application.DisplayAlerts = True
lws.Cells(irow, 1).Select
Application.ScreenUpdating = True

End Sub

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #483 by roller
Replied by roller on topic Avaya loginout CMS1
That part of the code is where the clean up of the login/out report takes place. First though can you tell me if you entrered a valid Agent User Group before running the macro, if you did you should be able to see some output already on the sheet. This output would have multiple login/out times at this stage. Can you see any output from Avaya?

Please Log in or Create an account to join the conversation.

  • williamrgre
  • Topic Author
  • Visitor
  • Visitor
9 years 2 months ago #484 by williamrgre
Replied by williamrgre on topic Avaya loginout CMS1
I was able to get the report working. Can I use the concept for graphs?

Please Log in or Create an account to join the conversation.

  • williamrgre
  • Topic Author
  • Visitor
  • Visitor
9 years 2 months ago #485 by williamrgre
Replied by williamrgre on topic Avaya loginout CMS1
I ran the cmsMulti Excel and it seems to work perfectly. However, the column names does copy over into the spreadsheet.

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #486 by roller
Replied by roller on topic Avaya loginout CMS1
Glad you got them working, these scripts are there to get you started and they need a bit of customization and fair user programming knowledge.

What concept graphs do you talk about before, I am not sure I follow your question?

As for the column names, if you are talking about the headers from the CMS reports then this line of code is responsible for setting the output format. Setting some of the False to true will output as a table, as data, etc... same in the export option from the menu from within the CMS report. The best way to know which is which is to go back to the Avaya application and generate your report, export it by setting the format you want it as from the menu then save it as a script. Open the script file using Notepad and check what the line below looks like to get the right settings for the export function.

Rep.ExportData("", 9, 0, False, False, True)

Please Log in or Create an account to join the conversation.

Time to create page: 0.846 seconds
Powered by Kunena Forum