Dim wd As New Word.Application
Dim ww As Document
Set ww = wd.Documents.Open("c:\Word.Doc")
wd.ActiveDocument.Protect Password:="pass", NoReset:=False, Type:=wdAllowOnlyFormFields
'離開Word且存檔
wd.Quit savechanges:=True
Set ww = Nothing
Set wd = Nothing
執行完後還是獨佔住
Dim ww As Document
Set ww = wd.Documents.Open("c:\Word.Doc")
wd.ActiveDocument.Protect Password:="pass", NoReset:=False, Type:=wdAllowOnlyFormFields
'離開Word且存檔
wd.Quit savechanges:=True
Set ww = Nothing
Set wd = Nothing
執行完後還是獨佔住
文章標籤
全站熱搜

好像是要文件先關吧 有一個常數好像是這樣 ww.close savechange="donotsavechange" <-請先查一這裡 好像是這樣 我忘記了 去查一下