一、工程裡先要引入office動態連線庫:Imports Microsoft.Office.Interop.Excel 或mports Microsoft.Office.Interop.Word二、宣告物件變數並例項化,如Dim wdApp As Microsoft.Office.Interop.Word.Application wdApp = New "宣告並例項化Microsoft.Office.Interop.Word.Application wdApp.Visible = True Dim wdDoc As Microsoft.Office.Interop.Word.DocumentwdDoc = wdApp.Documents.Add "wdDoc = wdApp.Documents.Open("word檔名")三、貼上並修改VBA程式碼1、物件以vb中宣告並例項化的物件為根,擴充套件2、替換不適用的函式等。3、在VB裡重新畫出VBA裡涉及的視窗4、.....5、總之,不熟悉的話,排程糾錯。
一、工程裡先要引入office動態連線庫:Imports Microsoft.Office.Interop.Excel 或mports Microsoft.Office.Interop.Word二、宣告物件變數並例項化,如Dim wdApp As Microsoft.Office.Interop.Word.Application wdApp = New "宣告並例項化Microsoft.Office.Interop.Word.Application wdApp.Visible = True Dim wdDoc As Microsoft.Office.Interop.Word.DocumentwdDoc = wdApp.Documents.Add "wdDoc = wdApp.Documents.Open("word檔名")三、貼上並修改VBA程式碼1、物件以vb中宣告並例項化的物件為根,擴充套件2、替換不適用的函式等。3、在VB裡重新畫出VBA裡涉及的視窗4、.....5、總之,不熟悉的話,排程糾錯。