我正在尝试将Excel文件acces从只读更改为通过MS Acces进行读/写,但仍保持只读状态。
代码:
Private Sub Knop11_Click()
Dim formaat As Integer
Dim wp As Integer
Dim wb As Object
formaat = Forms!Test!formaat.Value
wp = Forms!Test!wp.Value
Set objExcelApp = CreateObject("Excel.Application")
Set wb = objExcelApp.Workbooks.Open("D:\codetest\Map1")
Dim ws As Object
Set ws = wb.Sheets(1)
ws.Cells(1, 1).Value = formaat
ws.Cells(1, 2).Value = wp
wb.ChangeFileAccess Mode:=xlReadWrite
wb.Save
Set wb = Nothing
End Sub
谢谢!