zoukankan      html  css  js  c++  java
  • vba统计电脑计算机名和登陆的用户名

    Public Sub GetIPT()
        gipt = Trim(InputBox("请输入所在组,只需输入前面的字母代码即可 A- groupA B-groupB C-groupC D-groupD E-groupD "))
        strIPT = UCase(gipt)
        If strIPT = "A" Then GetInfo ("AirBus"): End
        If strIPT = "B" Then GetInfo ("Boeing"): End
        If strIPT = "C" Then GetInfo ("Engines"): End
        If strIPT = "D" Then GetInfo ("Bombarbier"): End
        If strIPT = "E" Then GetInfo ("BJ"): End
    End Sub
    Function GetInfo(IPT As String)
        Dim TheName As String
      
        
        On Error GoTo line1
        computername = Environ("Computername")
        UserName = Environ("Username")
        
        
        rw = Sheet1.Range("a65536").End(xlUp).Row
        i = 0
        i = i + rw
        Sheet2.Cells(i, 1) = computername
        Sheet2.Cells(i, 2) = UserName
        Sheet2.Cells(i, 3) = IPT
        
        Sheet2.Copy
        TheName = ThisWorkbook.Path & "./" & computername & ".xls"
        
        ActiveWorkbook.SaveAs Filename:=TheName, FileFormat:=xlNormal
        Sheet2.Range("A1:C65536").ClearContents
        MsgBox "信息已采集完," & computername & ".xls 文件已生成"
        ActiveWorkbook.Close
        
    line1:
    
    End Function
    

      

  • 相关阅读:
    中美土味摄影联合展览4.0
    计算机系统漫游
    Python连接Redis连接配置
    对kotlin和java中的synchronized的浅谈
    不务正业
    功能性测试分类
    Golang os/exec 实现
    面试研究所
    operator和if结构
    Mechanism for self refresh during C0
  • 原文地址:https://www.cnblogs.com/luoye00/p/10149902.html
Copyright © 2011-2022 走看看