|
可以获得文件名,可以打开,但是无法对打开的文件摘要进行修改,只能复制到单个文件中执行才能修改,求解。
Sub 修改当前文件夹下所有文件摘要()
Dim a As String, b As String
Dim doc As Document, myFile As String
Set word开启 = GetObject(, "word.Application")
word开启.Visible = True
Dim 地址
For Each 地址 In word开启.Documents
a = 地址.Path & "\"
Next
'**************************************
myFile = Dir(a & "*.docx")
Do While myFile <> ""
myFile = a & myFile
Set doc = Documents.Open(myFile)
MsgBox doc
With doc
.BuiltInDocumentProperties(wdPropertyTitle) = "myTitle"
.BuiltInDocumentProperties(wdPropertyAuthor) = "myAuthor"
.BuiltInDocumentProperties(wdPropertySubject) = "mySubject"
.BuiltInDocumentProperties(wdPropertyCompany) = "myCompany"
.BuiltInDocumentProperties(wdPropertyCategory) = "myCategory"
.BuiltInDocumentProperties(wdPropertyManager) = "myManager"
End With
'保存退出
doc.Save
doc.Close
Set doc = Nothing
'查找下一个
myFile = Dir
Loop
MsgBox "修改完成"
End Sub
|
|