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