Word搜索指定位置的所有DOC文档

 
Word搜索指定位置的所有DOC文档
2016-10-15 03:58:21 /故事大全

Dim Adoc As String, PsDoc As Document

On Error Resume Next

ChDrive "C" ‘设置当前驱动器盘符

ChDir "C:Documents and SettingsMy DocumentsTemp" ‘进入指定目录

Adoc = Dir("*.doc")

Application.ScreenUpdating = False

Do While Adoc <> "" ‘如果是文件夹,或者没有此文件,则会返回""

‘ MsgBox Adoc

Set PsDoc = Documents.Open(Adoc) ‘打开指定文档

PsDoc.Protect Type:=wdAllowOnlyFormFields, Password:="Password"

PsDoc.Close True

Adoc = Dir()

Loop

Application.ScreenUpdating = True

使用的时候,请将如上的代码放在宏中来使用。

所属专题:
如果您觉得本文或图片不错,请把它分享给您的朋友吧!

 
搜索
 
 
广告
 
 
广告
 
故事大全
 
版权所有- © 2012-2025 · 故事大全 SITEMAP站点地图-Foton Auman手机看故事 站点地图-Foton Auman