将打印机数据导出为ex​​cel并使用macros创build碳粉通知

我在一个支持多个部门的IT办公室工作,每个部门都有一组5个不同的打印机。 我们有一个局域网站点,用于显示打印机墨粉用尽情况。 当我们看到墨粉不足的通知后,我们用excel电子表格重新检查打印机号码,告诉我们这是哪种打印机型号,以及需要哪种types的碳粉补充。

我想知道是否可以用excel vba来巩固这个过程。 我想运行一个macros来检查局域网的低碳通知,重新检查打印机型号和重新填充信息,然后吐出一个msgbox,指出哪些打印机需要重新填充。 这将使我们免于手动点击和检查每台打印机的繁琐和单调的任务。

如果这是不可能的,至less应该创build一个macros来简单地显示一个msgbox,指出有多less“低碳粉”通知。

我可以提供更多的细节,但我想至less知道这样的事情是否有可能。 我是一个实习生,我认为这个问题可以通过excelmacros来解决,但是我没有经验。 我只有less量的.NET编程。 任何意见,将不胜感激!

首先启动msgbox通知:

Sub InfoInputs() Dim strPrinterNumber As String Dim strTonerNumber As String strPrinterNumber = InputBox("Which printers are you servicing? (Please enter the full printer name ie ATL-15-14S220)", "Printer Selection") If strPrinterNumber = "" Then MsgBox "You need to enter a valid printer ID." Exit Sub End If If strPrinterNumber <> "" Then MsgBox "you chose: " & strPrinterNumber If strPrinterNumber = Range("E2:E30").Find(What:=strPrinterNumber, MatchCase:=True) Then strTonerNumber = Range("F3:F30,G3:G30,H3:H30,I3:I30") MsgBox "You need: strTonerNumber" Else MsgBox "You need to enter a valid printer ID." End If End If End Sub 

 Sub GetPrinterAlert() 'Get Alert from Xerox WorkCentre With ActiveSheet.QueryTables.Add(Connection:= _ "URL;yourprinterurl/status/general.php", Destination:=Range("$A$1")) .Name = "general" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlAllTables .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With 'get me the total rows output irows = Cells(Rows.Count, "B").End(xlUp).Row 'loop thru the list For i = irows To 2 Step -1 'code that start with 09 = toner needed. If Left(Cells(i, 2).Value, 2) <> "09" Then 'do something with this row. '09-565-00 The Magenta Toner (M) is near end of life. User intervention is required to reorder Magenta Toner; do not replace until prompted. Machine services are unaffected. '09-566-00 The Cyan Toner (C) is near end of life. User intervention is required to reorder Cyan Toner; do not replace until prompted. Machine services are unaffected. End If Next i End Sub