Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question VBA for Agent Trace Report

  • yesudass
  • Topic Author
  • Visitor
  • Visitor
9 years 5 months ago #471 by yesudass
VBA for Agent Trace Report was created by yesudass
Hi...trying to extract the agent trace report from excel through the VBA macro. but the data is not populating can some once please help on this as this is the first task that i am working upon in automating the report.

Please Help...Mentioned below is the code...i am using excel 2007, Avaya 16.2 version, error message " Data is not getting exported into excel"
ACD used is 1, do i need to have any special access to get this report generated "like ODBC connectivity" can you please tell me where have i done the mistake. i have also pasted the script details below this code. so that you all have more clues in finding the error and giving me the solution.


Public Sub CMSConn()
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")
serverAddress = ""
'serverAddress = ""
mydate = "10/28/2014"
UserName = ""
passW = ""
agentName = ""
If cvsApp.CreateServer(UserName, "", "", serverAddress, False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.login(UserName, passW, serverAddress, "ENU") Then
On Error Resume Next
cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\Agent\Trace by Location")
If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The Report " & "Historical\Agent\Trace by Location" & " was not found on ACD 1", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("ACSERR.cvslog")
Log.AutoLogWrite "The Report " & "Historical\Agent\Trace by Location" & " was not found on ACD 1"
Set Log = Nothing
End If
Else
b = cvsSrv.Reports.CreateReport(Info, Rep)
If b Then
Debug.Print Rep.SetProperty("Agent", agentName)
Debug.Print Rep.SetProperty("Dates", mydate)
Debug.Print Rep.SetProperty("Times", "00:00-23:59")
b = Rep.ExportallData("", 9, 0, False, True, True)
Set wk = ThisWorkbook
wk.Sheets(1).Cells.ClearContents
wk.Sheets(1).Cells(1, 1).PasteSpecial xlPasteValues

'b = Rep.ExportData(fileP, 9, 0, False, True, True)


Rep.Quit
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If
End If

Set Info = Nothing
End If

End If

cvsConn.logout
cvsConn.Disconnect
cvsSrv.Connected = False
Set Log = Nothing
Set Rep = Nothing
Set cvsSrv = Nothing
Set cvsConn = Nothing
Set cvsApp = Nothing
MsgBox "completed"
End Sub

******************************************************
*************Code in the script***********************
'LANGUAGE=ENU
'SERVERNAME=syd-aesc-cms1
Public Sub Main()

'## cvs_cmd_begin
'## ID = 2001
'## Description = "Report: Historical: Agent: Trace by Location: Export Data"
'## Parameters.Add "Report: Historical: Agent: Trace by Location: Export Data","_Desc"
'## Parameters.Add "Reports","_Catalog"
'## Parameters.Add "2","_Action"
'## Parameters.Add "1","_Quit"
'## Parameters.Add "Historical\Agent\Trace by Location","_Report"
'## Parameters.Add "1","_ACD"
'## Parameters.Add "-108","_Top"
'## Parameters.Add "-108","_Left"
'## Parameters.Add "23256","_Width"
'## Parameters.Add "12768","_Height"
'## Parameters.Add "default","_TimeZone"
'## Parameters.Add "The report Historical\Agent\Trace by Location was not found on ACD 1.","_ReportNotFound"
'## Parameters.Add "*","_BeginProperties"
'## Parameters.Add "53096","Agent"
'## Parameters.Add "10/28/2014","Dates"
'## Parameters.Add "00:00-23:30","Times"
'## Parameters.Add "*","_EndProperties"
'## Parameters.Add "*","_BeginViews"
'## Parameters.Add "*","_EndViews"
'## Parameters.Add "C:\Users\ykkumar\Desktop\abc.txt","_Output"
'## Parameters.Add "9","_FldSep"
'## Parameters.Add "0","_TextDelim"
'## Parameters.Add "False","_NullToZero"
'## Parameters.Add "True","_Labels"
'## Parameters.Add "True","_DurSecs"

On Error Resume Next

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\Agent\Trace by Location")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\Agent\Trace by Location was not found on ACD 1.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("ACSERR.cvsLog")
Log.AutoLogWrite "The report Historical\Agent\Trace by Location was not found on ACD 1."
Set Log = Nothing
End If
Else

b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then

Rep.Window.Top = -108
Rep.Window.Left = -108
Rep.Window.Width = 23256
Rep.Window.Height = 12768


Rep.TimeZone = "default"



Rep.SetProperty "Agent","53096"

Rep.SetProperty "Dates","10/28/2014"

Rep.SetProperty "Times","00:00-23:30"




b = Rep.ExportData("C:\Users\ykkumar\Desktop\abc.txt", 9, 0, False, True, True)





Rep.Quit



If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

End If
Set Info = Nothing
'## cvs_cmd_end

End Sub
********************************************************************

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

More
9 years 5 months ago - 7 months 5 days ago #472 by roller
Replied by roller on topic VBA for Agent Trace Report
I copied your code into my own Excel file to test and you are correct it doesn't work.

Try changing the below lines of code:

b = Rep.ExportallData("", 9, 0, False, True, True)
Set wk = ThisWorkbook
wk.Sheets(1).Cells.ClearContents
wk.Sheets(1).Cells(1, 1).PasteSpecial xlPasteValues

and replace them all with the below instead, exactly as is word for word:

b = Rep.ExportData("", 9, 0, False, True, True)
Set wk = ThisWorkbook
wk.Sheets(1).Cells.ClearContents
wk.Sheets(1).Cells(1, 1).PasteSpecial

A full working sample in Excel VBA file can be downloaded here:

AVAYA CMS Agent Trace Report Excel Macro VBA - $7.50 : fracta.net Edgar Badawy, We keep it simple
Last edit: 7 months 5 days ago by roller.

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

  • yesudass
  • Topic Author
  • Visitor
  • Visitor
9 years 5 months ago #473 by yesudass
Replied by yesudass on topic VBA for Agent Trace Report
Hello,

Thanks a ton for your help...i got this when i executed the code "960|60|12"

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

More
9 years 5 months ago #474 by roller
Replied by roller on topic VBA for Agent Trace Report
What are you saying did it work? What's the 960 60 12?? Don't assume I read minds:)

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

Time to create page: 0.859 seconds
Powered by Kunena Forum