Excel工作簿的ChangeFileAccess通过MS Acces进行ReadWrite

时间:2019-04-17 19:22:56

标签: excel vba

我正在尝试将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

谢谢!

0 个答案:

没有答案