Hi All,
i don't know anything about VBA, but I was able to locate a VBA script that works to fit my needs. The only thing that does not work is the "Cancel' button that populates on the Input boxes. Can someone help me fill in the gap for this?
----------
Sub AZ_Monthly()
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 CMSRunning As String
Dim objWMIcimv2 As Object
Dim objProcess As Object
Dim objList As Object
CMSRunning = "acsSRV.exe"
Set objWMIcimv2 = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2") 'Connect to CIMV2 Namespace
Set objList = objWMIcimv2.ExecQuery _
("select * from win32_process where name='" & CMSRunning & "'") 'determine if CMS is running
If objList.Count = 0 Then 'If 0 then process isn't running
End If
Set cvsApp = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvsSrv = CreateObject("ACSUPSRV.cvsServer")
Set Rep = CreateObject("ACSREP.cvsReport")
Application.ScreenUpdating = 0
Set cvsSrv = cvsApp.Servers(1)
Application.ScreenUpdating = 1
AgGrp = InputBox("Enter Agent Group Name", "Agent Group", "Medicare BSU AZ") 'change as needed for variables to enter into report
RpDate = InputBox("Enter Date", "Date", "XX/XX/XXXX-XX/XX/XXXX") 'change as needed for variables to enter into report
'Start code from CMS Export script
On Error Resume Next
cvsSrv.Reports.ACD = 2
Set Info = cvsSrv.Reports.Reports("Historical\Designer\Medicare BSU Metrics")
b = cvsSrv.Reports.CreateReport(Info, Rep)
If b Then
Rep.Window.Top = 1830
Rep.Window.Left = 975
Rep.Window.Width = 17610
Rep.Window.Height = 11910
Rep.SetProperty "Agent Group", AgGrp 'change as needed for report variables
Rep.SetProperty "Dates", RpDate 'change as needed for report variables
Rep.TimeZone = "default"
b = Rep.ExportData("", 9, 0, True, True, True)
Rep.Quit
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If
Set Info = Nothing
' End code from CMS Export Script
cvsConn.logout
cvsConn.Disconnect
cvsSrv.Connected = False
Set Log = Nothing
Set Rep = Nothing
Set cvsSrv = Nothing
Set cvsConn = Nothing
Set cvsApp = Nothing
Set Info = Nothing
Range("Z53").Select
ActiveSheet.Paste
End Sub
Bookmarks