Excel VBA 操作 Word(入门篇)

Excel VBA 操作 Word(入门篇)

ID:47034343

大小:25.39 KB

页数:11页

时间:2019-07-02

Excel VBA 操作 Word(入门篇)_第1页
Excel VBA 操作 Word(入门篇)_第2页
Excel VBA 操作 Word(入门篇)_第3页
Excel VBA 操作 Word(入门篇)_第4页
Excel VBA 操作 Word(入门篇)_第5页
资源描述:

《Excel VBA 操作 Word(入门篇)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、本文的对象是:有一定ExcelVBA基础,对WordVBA还没有什么认识,想在Excel中通过VBA操作Word还有困难的人。一、新建Word引用需要首先创建一个对WordApplication对象的引用。在VBA中,工具-引用,选取“MicroSoftWord11.0ObjectLibrary”。方法一、NewWord.Application  DimWordappAsWord.Application  SetWordapp=NewWord.Application  Wordapp.Visible=True      

2、        '可见  'Wordapp.ScreenUpdating=False        '屏幕刷新  DimWordDAsWord.Document    '定义word类SetWordD=Wordapp.Documents.Add            '新建文档‘SetWordD=Wordapp.Documents.open(filename)      '打开文档……WordD.Close                '关闭文档SetWordD=NothingWordApp.Quit         

3、       '退出Word对象方法二、CreateObject  DimWordAppAsObject  SetWordApp=CreateObject("Word.Application")  '新建Word对象‘后续操作及退出一样……方法三、GetObject文件已打开的情况下,使用:SetWordD=GetObject(filename),可建立对文档的引用,如果文件没有打开,则还需要先用方法一或二来操作。至于方法一和方法二的区别,在网上询问了一下,大师们的回答是:方法一:前期绑定,好处是在对象后输入句点可以给出

4、快速提示,因为需要先引用对象,所以容易出现版本兼容问题。方法二:后期绑定,没有提示,根据运行代码机器上对象的版本创建对象,兼容性好。ofvisionYibinformationintheCentersurroundedby,organicdispersionbandofbead-spacelayoutstructure,asleadingdevelopmentofthecitytotheEastalongtheYangtzeRiver.ShiGuarea,lingangnewvisiontoexpand,Naxidist

5、ricttotheNorth,theEastopenplacestoexpand,Jianganeastwardconnection,PingShan,radiationtotheWest;theSouthBankarea,theminjiangRiverarea,GoldenSandsareaonalong-termbasisinareasonablespacetodevelop,perfecturbandistrictalongtheYangtzeRiverinYibin"Ribbonmulti-center"str

6、ategicvisionofspaceframe.YibinCenterCitydevelopmentconstructionsteeringextensiontypeextendedandconnotationtypeupgradesimultaneouslyofmode,inMetroconstructionofwhileiscommittedtooldcitytransformationandbuiltdistrictofperfect,throughliveandindustrywithtoofreasonabl

7、elayoutoptimizationcitystructure,improvecitytrafficoperationefficiency;vigorouslyimprovedcityenvironment,shapingcityfeatures,upgradecityquality,playcityofservicefunction,formedhasperfectmodernservicecapacityofbigcity.Constructionofurbangreenspacesystem,promotingt

8、heconstructionofperipheralgreenspaceandprotectionofhistorical提示:有时二者有较大区别,可论坛搜索字典对象,建议编写代码时使用前期绑定,发布时使用后期绑定。二、认识Word的结构Excel有:Excel.Application                

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。