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

阅读 59

2022-08-02

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)

0 0 举报