回覆列表
-
1 # zhopf24916
-
2 # 滴逃逃
objWorkBook.Close (True) "關閉工作簿並儲存所做的修改
objExcelFile.Quit
Set objWorkBook = Nothing
Set objImportSheet1 = Nothing
Set objExcelFile = Nothing
objWorkBook.Close (True) "關閉工作簿並儲存所做的修改
objExcelFile.Quit
Set objWorkBook = Nothing
Set objImportSheet1 = Nothing
Set objExcelFile = Nothing
Set xlApp = CreateObject("Excel.Application") "建立EXCEL物件 Set xlBook = xlApp.Workbooks.Open(App.Path & "\委託書.xls") "開啟已經存在的EXCEL工件簿檔案 xlApp.Visible = IIf(fg = 0, True, False) "設定EXCEL物件可見(或不可見)預覽設定為可見 Set xlSheet = xlBook.Worksheets("sheet1") "設定活動工作表...... xlApp.DisplayAlerts = False "不提示是否覆蓋 xlBook.SaveAs App.Path & "\檢驗委託書\" & Trim(w.C_hpzl.Text) & Trim(w.T_hphm.Text) & "_" & a.jylsh & ".xls" "儲存當前發票資訊 xlBook.Close (False) "關閉工作簿 xlApp.Visible = False xlApp.Quit "結束EXCEL物件 Set xlSheet = Nothing Set xlBook = Nothing Set xlApp = Nothing "釋放xlApp物件VB程式碼自己建立的是這樣關閉的其他的需要呼叫系統API來結束程序