VBA通过CMS

时间:2017-06-30 22:43:20

标签: excel-vba avaya vba excel

使用下面的代码,我可以获得使用CMS的excel,但似乎我的许可证不随附代码。我收到错误声明"分组/技能无法修改。 665和#34;没有书面许可。手动扫描时,我有权获得665(和669)。知道我在这里做错了吗?

 Sub Swap_Skill()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
 Dim AcmS As String

 Set cvsApp = CreateObject("ACSUP.cvsApplication")
 Set cvsConn = CreateObject("ACSCN.cvsConnection")
 Set cvsSrv = cvsApp.Servers(1)
 Set Rep = CreateObject("ACSREP.cvsReport")
 Set cvsSrv = cvsApp.Servers(1)
 AcmS = Range("K6").Value 'variable value, currently 1217259
 On Error Resume Next
 Set AgMngObj = cvsSrv.AgentMgmt
 On Error Resume Next

 Set AgMngObj = cvsSrv.AgentMgmt
 ReDim SetArr(2, 3)
 SetArr(1, 1) = Range("L4").Value 'variable value, currently 665
 SetArr(1, 2) = 1
 SetArr(1, 3) = 0
 SetArr(2, 1) = Range("N4").Value 'variable value, currently 669
 SetArr(2, 2) = 12
 SetArr(2, 3) = 0

 AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
 AgMngObj.OleAgentSetSkill 1, "" & AcmS & "", 1, 0, 0, 0, 2, SetArr, ""

 Set AgMngObj = Nothing
 Set cvsApp = Nothing
 Set cvsConn = Nothing
 Set cvsSrv = Nothing
 End Sub 

1 个答案:

答案 0 :(得分:0)

也许你很久以前就解决了这个问题,但是否则我会把你的代码粘贴给技能代理人:

Option Explicit
Dim cvsApp As New ACSUP.cvsApplication
Dim cvsConn As New ACSCN.cvsConnection
Dim cvsSrv As New ACSUPSRV.cvsServer
Dim Rep As New ACSREP.cvsReport
Sub SkillAgentes()


    Application.ScreenUpdating = False
    Set cvsSrv = cvsApp.Servers(1)

    Dim LastRow As Long, LastCol As Long, ws As Worksheet, wsData As Worksheet, F As Integer, C As Integer, _
    i As Integer, S As Integer, Skill As String, Prtr As Integer, SetArr() As Variant, Agentes As String, _
    Cantidad As Integer, ACD As Integer, wsA As Worksheet, wsS As Worksheet, AgMngObj As Object

    Set wsData = ThisWorkbook.Sheets("Trasvases")
    Set ws = ThisWorkbook.Sheets("Cambios Skill")
    Set wsA = ThisWorkbook.Sheets("Agentes")
    Set wsS = ThisWorkbook.Sheets("Skills")
    Set AgMngObj = cvsSrv.AgentMgmt

    S = 1
    LastRow = ws.Range("F" & ws.Rows.Count).End(xlUp).Row
    For i = 2 To LastRow
        LastCol = ws.Cells(i, 8).End(xlToRight).Column
        Agentes = ws.Cells(i, ws.Cells.Find("login").Column)
        Cantidad = ws.Cells(i, 3)
        If ws.Cells(i, 2) = "SUR" Then ACD = 1
        If ws.Cells(i, 2) = "NORTE" Then ACD = 2
        ReDim SetArr(Cantidad, 4)
        For C = 8 To LastCol Step 2
            On Error Resume Next
            Skill = ws.Cells(i, C).Value
            Prtr = ws.Cells(i, C + 1).Value
            SetArr(S, 1) = Skill
            SetArr(S, 2) = Prtr
            SetArr(S, 3) = 0
            SetArr(S, 4) = 0
            S = S + 1
        Next C
        AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
        AgMngObj.OleAgentSetSkill_R16_1 ACD, Agentes, Prtr, 0, 0, 0, Cantidad, SetArr, ""
        Dim Tiempo As String: Tiempo = Format(Now, "hh:mm:ss")
        ws.Cells(i, 50).Value = Tiempo


        LastRow = wsData.Range("A1000").End(xlUp).Row
        Dim x As Integer
        For x = 1 To LastRow
            If wsData.Cells(x, 5) = wsA.Cells.Find(Agentes).Offset(0, 1) Then
                If wsData.Cells(x, 7) = 0 Then
                    wsData.Cells(x, 7).Value = Tiempo
                    GoTo Cambiado
                End If
            End If
        Next
        F = wsData.Range("A1000").End(xlUp).Row + 1
        wsData.Cells(F, 1).Value = Format(Date, "dd/mm/yyyy")
        If Format(Date, "dd") < 13 Then wsData.Cells(F, 1).Value = Format(Date, "mm/dd/yyyy")
        wsData.Cells(F, 2).Value = ws.Cells(19, 1)
        wsData.Cells(F, 3).Value = ws.Cells(21, 1)
        wsData.Cells(F, 4).Value = wsA.Cells.Find(Agentes, LookAt:=xlWhole).Offset(0, 2).Value
        wsData.Cells(F, 5).Value = wsA.Cells.Find(Agentes, LookAt:=xlWhole).Offset(0, 1)
        wsData.Cells(F, 6).Value = Tiempo
        wsData.Cells(F, 8).FormulaR1C1 = "=IF(RC[-1]="""","""",RC[-1]-RC[-2])"
        wsData.Cells(F, 9).FormulaR1C1 = ws.Cells(i, ws.Cells.Find("Modo Origen").Column)
        wsData.Cells(F, 10).Value = _
            wsS.Cells(wsS.Cells.Find(ws.Cells(i, ws.Cells.Find("Modo a conectar:").Column)).Row, _
            wsS.Cells.Find("Destino").Column)
        wsData.Cells(F, 11).Value = ws.Cells(i, ws.Cells.Find("Motivo Trasvase").Column).Value
Cambiado:
        S = 1
    Next i

确实有太多的代码,但我相信你可以得到你需要的东西。使用此代码,您可以根据需要立即更改尽可能多的代理技能。这是您输入登录和技能的表格应该如何。请注意,您必须至少输入ACD,您要投入的技能数量,登录,技能及其优先级。

What the table looks like

大部分内容都是记录代理商的来源,进入并且花费在这个变化上的时间。

希望对我的英语有所帮助和抱歉。