0
我遇到一些問題,其中我的Access項目將打開一個Excel工作簿,刪除第一行,然後保存並關閉並重復5次。我唯一的問題是它每運行一次都會出現備份副本。Excel在打開/關閉時保存不需要的備份副本
示例: File1.xls 由於某種原因,File1.xls的備份也得到保存。任何想法我做錯了什麼?是否由於打開文件的某種寫保護而進行備份?
Public Sub RemoveFirstRowExcel(SSFile As String)
On Error GoTo Exit_Proc
Dim xlApp As Object
Dim xlSheet As Object
Set xlApp = CreateObject("Excel.Application")
Set xlSheet = xlApp.Workbooks.Open(SSFile).Sheets(1)
With xlApp
'.Application.Sheets(SSSheet).Select
.Application.Rows("1:1").Select
.Application.Selection.EntireRow.Delete
.Application.ActiveWorkbook.Close SaveChanges:=True
.Quit
End With
Exit_Proc:
Set xlApp = Nothing
Set xlSheet = Nothing
End Sub