Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question Export CMS Supervisor R17 to Excel

More
9 years 2 months ago #520 by roller
Replace the 2 debug.print with msgbox and see if you get a message saying true or false?

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

More
9 years 2 months ago #521 by roller
Oh by the way of you have been testing the script for a while you might have the correct code but many orphan server objects running. Check your task manager to see if there are lots of reports and servers running. You need to clean them. Restarting the pc will do the trick.

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

  • SMOnline
  • Topic Author
  • Visitor
  • Visitor
9 years 2 months ago #522 by SMOnline
Replied by SMOnline on topic Export CMS Supervisor R17 to Excel
OK... I'm getting True in the message box for both SetProperty lines.
(I've also rebooted just to have a 'clear out' as it were.)

I've been going through the code in step/debug mode (F8) while keeping an eye on the Locals window and I notice that 'b' is always set to Nothing. Would this have any effect on things?
(I also tried putting 'Set' in front of the 'b' just for fun/out of desperation but it made no difference!)

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

More
9 years 2 months ago #523 by roller
If you are getting true then that is a good sign, are you sure there is data for that date?

b is nothing always that's correct.

I tried using your script as is on my PC but i changed the report and parameters and it worked for me. Why don't you try running the below standard report (Historical\Agent\Group Summary Daily) to see if that works at least - change the parameters to match yours.

Before you run the below I want you to try another test, for the test you must have the Avaya application closed while running the below script. If you look carefully I made two changes to the code. In the below line of code the False was changed to True. What this does is it actually displays the Avaya report on the screen just like it would if running from the application. Check to see if anything pops up on your screen, at least we know how far it is working.

If cvsApp.CreateServer(UserName, "", "", serverAddress, True, "ENU", cvssrv,...

I also added a STOP in the code near the end, we will need that to pause the code so you can see the report opens. If the sub is allowed to finish the report will open and close very quickly and you might not see it as the Objects are destroyed at the end of the subroutine.

See how you go but that's all I can help you with short of doing a remote session to you PC to debug the script.




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 = "x.x.x.x"
UserName = "xx"
passW = "xxx"




If cvsApp.CreateServer(UserName, "", "", serverAddress, True, "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\Group Summary Daily")
If Info Is Nothing Then
If cvssrv.Interactive Then
MsgBox "The Report " & "Historical\Agent\Group Summary Daily" & " was not found on ACD 1", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("ACSERR.cvslog")
Log.AutoLogWrite "The Report " & "Historical\Agent\Group Summary Daily" & " was not found on ACD 1"
Set Log = Nothing
End If
Else

b = cvssrv.Reports.CreateReport(Info, rep)
If b Then
rep.SetProperty "Agent Group", "Alexandria CC"
rep.SetProperty "Date", "26/02/2015"
b = rep.ExportData("", 9, 0, False, True, True)
Set wk = ThisWorkbook
wk.Sheets(1).Cells.ClearContents
wk.Sheets(1).Cells(1, 1).PasteSpecial
Stop
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

End Sub

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

  • SMOnline
  • Topic Author
  • Visitor
  • Visitor
9 years 2 months ago #524 by SMOnline
Replied by SMOnline on topic Export CMS Supervisor R17 to Excel
Hmmm, interesting...
I changed the false to True and ran it again (with a stop included).
Got a message saying "The report is incomplete and cannot run".
So I then changed it to look at the report you suggested (Group Daily Summary) and guess what: it ran perfectly. It displayed the report on screen and downloaded it into Excel.

So: I can only assume then that the original 'designer' report I was using (which I should stress I didn't create!) is wrong somehow and this is stopping the VBA from working correctly.
The plot thickens!

Thank you so much for your assistance with this - it's such a relief to finally know that the code I'm using is correct!

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

More
9 years 2 months ago #525 by roller
Maybe that designer report needs the bit about rep.TimeZone = "default"

That's one thing I see in the original script that's not in the vba. Long shot but worth a try!

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

Time to create page: 0.443 seconds
Powered by Kunena Forum