0
点赞
收藏
分享

微信扫一扫

VBS向已经存在的Excel里面输入数据

灵魂跑者 2022-08-02 阅读 59

Function a()
    On Error Resume next
    path="C:\Users\Administrator\Desktop\Sccripts\testSet.xls"
    Set excelFso=CreateObject("Excel.application")
    Set excelWork=excelFso.Workbooks.Open(path)
    Set excelSheet=excelWork.Worksheets(1)
    MsgBox excelSheet.UsedRange.rows.count
    excelSheet.rows(3).insert
    excelFso.cells(3,3).Value="Hello_Dou_Yun"

    excelFso.Save
    excelFso.Quit
    Set excelFso=nothing
    shell.Run "taskkill /F /IM Excel.exe"
End Function

Function b(d)
    On Error Resume Next 
    d()
End Function 

b(a)

举报

相关推荐

0 条评论