office交流網(wǎng)--QQ交流群號及微信交流群

Access培訓(xùn)群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請用微信掃碼)

        

Access創(chuàng)建空白的Word文檔

2017-10-17 17:12:00
tmtony8
原創(chuàng)
4563

Access作為Office的組件,和Word,excel 交互數(shù)據(jù)是肯定可以的。在Access中操作其他Office組件也是我們常用功能之一。

比如說把刷選好的數(shù)據(jù)導(dǎo)出到Excel,按Access內(nèi)容創(chuàng)建一份Word簡歷

這里先來介紹一下如何創(chuàng)建一個空白的Word文檔

分享兩種方法:


1.通過代碼定義對象的方法直接創(chuàng)建

Public Sub 創(chuàng)建空白的word文檔()
    Dim wordApp As Object
    Dim wordDoc As Object
    '創(chuàng)建word應(yīng)用程序
    Set wordApp = CreateObject("word.application")
    '創(chuàng)建的word應(yīng)用程序設(shè)置為可視
    wordApp.Visible = True
    '在word應(yīng)用程序中新建空白word文檔
    Set wordDoc = wordApp.Documents.Add
    Set wordApp = Nothing
    Set wordDoc = Nothing
End Sub



2.通過定義word應(yīng)用程序?qū)ο蠛臀臋n對象來實現(xiàn)

注意:此方法需要在引用“Microsoft Word 14.0 Object Library”庫。

Public Sub 創(chuàng)建空白的word文檔2()
    Dim wordApp As Word.Application
    Dim wordDoc As Word.Document
'    創(chuàng)建Word應(yīng)用程序?qū)ο蟛⑻砑涌瞻孜臋n
    Set wordApp = CreateObject("word.application")
    Set wordDoc = wordApp.Documents.Add
'    設(shè)置Word應(yīng)用程序可以狀態(tài)為真
    wordApp.Visible = True
End Sub



    分享
    文章分類
    聯(lián)系我們
    聯(lián)系人: 王先生
    Email: 18449932@qq.com
    QQ: 18449932
    微博: officecn01
    移動訪問