教程中国
PHOTOSHOP CS9.0中文版 MAYA 8.5 FOR WINDOWS Corel Painter v9.0 Flash MX2004 中文版 Illustrator cs2 中文版
VC++6.0含sp6 中英文版 VB6.0 +sp6 简体中文版 Borland Delphi 7汉化版 MSDN for vb6.0中文版 Visual Studio 2005简体
教程中国下属 文件存储共享专家BIBIDU.COM 提供大型软件,教材,源码,电影,音乐,图书等下载 更多精品请点此进入
  您目前所在位置: 教程中国 >> 编程基地 >> VB >> 用VB轻松打开MS Word文档 RSS订阅
用VB轻松打开MS Word文档
教程(视频,书籍)下载:  ASP.NET AutoCAD 数据库 C# ASP java photoshop 网页设计 delphi 3dmax Flash C++ VB 张孝祥 实例   更多请进入BIBIDU搜索
IT搜索引擎   
Effortlessly open Microsoft Word documents from VB

Often, your application may have cause to open a Microsoft Word
document. Rather than accessing it via some directory method, such
as the FileSystemObject or Shell, try opening it directly via Word
Automation. This approach will make it that much easier to read
and manipulate the document注释:s properties and content.

To open a Word document via Automation, you must first work your
way down the object hierarchy to the Documents collection, which
is a member of the top-level Application object. As you can guess,
the Documents collection holds all open documents, and exposes
an Open method. To use this method you simply pass in the full
path of the document you wish to open. The Open method in turn
returns a Document object that represents the document you requested.
Once obtained, you can then read and manipulate the file注释:s contents
as you see fit. The following code shows an example:

Private Sub Command1_Click()
Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Dim strFileName As String
strFileName = "D:\Articles\Title.doc"
Set appWord = New Word.Application
Set wrdDoc = appWord.Documents.Open(strFileName)
MsgBox wrdDoc.Path & "\" & wrdDoc.Name
wrdDoc.Close False
appWord.Quit
Set wrdDoc = Nothing
Set appWord = Nothing
End Sub

来源:upschool.cn
作者:
关键字:用VB轻松打开MS,Word文档
发表日期:2006-12-20 19:57:28

网页显示有限 阅读全文请下载本文完整版WORD文档

上一篇:Use regular expressions for VB wildcard string extractions   下一篇:Sql语句-Update


2009-1-10 10:26:28
本文的相类似文章
  • 遭遇Word文档病毒的解决办法
  • 保护Word文档我另有鲜招
  • Word文档双面打印 页码位置随我怎么设
  • Word文档无法保存怎么办
  • Word文档保护隐私的七招秘技
  • word文档加密漏洞破解方法详解
  • 用vb将word文档(或其他的二进制数据)生成xml文件并互相转换
  • 用VB轻松打开MS Word文档
  • 中文输入法随Word文档同时打开
  • 让Word文档中的重复字符串自动更新
  • 在学习中进步 在进步中成长 教程中国相随您的成长之路
    华腾联合科技股份有限公司版权所有
    广告联系:Rosibo@163.com