每次我尝试在 VBA excel 中打开 word 文档时,我都会在后台弹出一个窗口,询问我如何打开它,因为它被标记为只读。我查看了文件的属性,它不是只读的,但它处于修订控制(tortoise-SVN)中。
Sub ReadSpec()
'References
' Microsoft Word 14.0 Object library
'
Dim Paragraphe As Object
Dim WordApp As Word.Application
Set WordApp = CreateObject("Word.Application")
Dim WordDoc As Word.Document
Set WordDoc = WordApp.Documents.Open("Spec.docx")
WordApp.Visible = True
WordDoc.Close
WordApp.Quit
End Sub