Sub 新建保存另存()uDP检测VBA
'新建文档uDP检测VBA
Documents.AdduDP检测VBA
'保存[可以保存在原来位置]uDP检测VBA
ActiveDocument.SaveuDP检测VBA
'另存为[需要指定位置]uDP检测VBA
ActiveDocument.SaveAs2 "c:\1.docx"uDP检测VBA
'关闭uDP检测VBA
ActiveDocument.CloseuDP检测VBA
End SubuDP检测VBA
uDP检测VBA
Sub 可以搭配使用()uDP检测VBA
'新建文档并另存uDP检测VBA
Documents.Add.SaveAs2 "c:\1.docx"uDP检测VBA
'关闭uDP检测VBA
ActiveDocument.CloseuDP检测VBA
End SubuDP检测VBA
uDP检测VBA
Sub 打开()uDP检测VBA
'打开指定文件【批量打开后面课程会介绍】uDP检测VBA
Documents.Open "c:\1.docx"uDP检测VBA
'在光标位置插入uDP检测VBA
Selection.TypeText "孙兴华"uDP检测VBA
'不保存uDP检测VBA
ActiveDocument.Close savechanges:=wdDoNotSaveChangesuDP检测VBA
End SubuDP检测VBA
uDP检测VBA
uDP检测VBA
其它常用代码:uDP检测VBA
【1】如果活动文档在上次保存后进行了修改,则保存活动文档uDP检测VBA
If ActiveDocument.Saved=False then ActiveDocument.SaveuDP检测VBA
【2】保存Documents集合中的每一个文档,但在保存文档时不提示用户uDP检测VBA
Documents.Save Noprompt:=True,OriginalFormat:=wdOriginalDocumentFormatuDP检测VBA
参数uDP检测VBA |
中文uDP检测VBA |
wdOriginalDocumentFormatuDP检测VBA |
原始文档格式。uDP检测VBA |
wdPromptUseruDP检测VBA |
提示用户选择文档格式。uDP检测VBA |
wdWordDocumentuDP检测VBA |
Microsoft Word 文档格式。uDP检测VBA |
|