if dir("d:/excel.bz") = "" then '判斷excel是否打開 set xlapp = createobject("excel.application") '創建excel應用類 xlapp.visible = true '設置excel可見 set xlbook = xlapp.workbooks.open("d:/test.xls") '打開excel工作簿 set xlsheet = xlbook.worksheets(1) '打開excel工作表
application.cutcopymode = false for i = 1 to 9 range("a" & (i + 1)).select activecell.formular1c1 = "項目" & i range("b" & (i + 1)).select activecell.formular1c1 = i range("c" & (i + 1)).select activecell.formular1c1 = "說明" & i next