Private Sub 打開(kāi)本地文件寫(xiě)入不提示保存退出_Click()
Set xlApp = CreateObject("Excel.Application") '創(chuàng)建EXCEL對(duì)象
Set xlBook = xlApp.Workbooks.Open("C:\Users\Administrator\Desktop\ls\zgx.xls") '打開(kāi)已經(jīng)存在的EXCEL工件簿文件
xlApp.Visible = 0 '設(shè)置EXCEL對(duì)象可見(jiàn)(或不可見(jiàn))
Set xlSheet = xlBook.Worksheets("sheet1") '設(shè)置活動(dòng)工作表
xlSheet.Cells(3, 3) = "zhg2223333fgfx" '給單元格(row,col)賦值
xlSheet.Cells(2, 6).Interior.ColorIndex = 3 '設(shè)計(jì)單元格顏色i=1--56
xlApp.DisplayAlerts = False '保存/不保存Excel文件時(shí)不提示
xlBook.Close savechanges:=1
xlApp.DisplayAlerts = True '保存/不保存Excel文件時(shí)提示
xlApp.quit
Set xlApp = Nothing
End Sub
聯(lián)系客服