access vba excel操作の基本のコードは、以下の通り。 とりあえず、excel文書をオープンし、Sheet1を削除、上書き保存するコードを書いてみた。
Dim exApp As Object
Dim Wb As Object
Dim buf As string
Set exApp = CreateObject("Excel.Application")
exApp.Visible = False
exApp.DisplayAlerts = False
Set Wb = ExApp.Workbooks.Open("¥¥dir1¥dir2¥filename.xlsx")
or
buf = "¥¥dir1¥dir2"
file1 = dir(buf & "filename.xlsx")
exApp.workbooks(file1).open file1
With Wb
.Worksheets("Sheet1").Delete
other codes
.Save
.Close
End With
exApp.DisplayAlerts = True
exApp.Quit
Set exApp = Nothing
0 件のコメント:
コメントを投稿