当我按下创建的导出按钮时,我希望列表框中列出的数据以非表格格式导出到Word文档中,但我发现了一些问题,到目前为止单击“导出”按钮时打开文档,但无法将数据提取到Word文档中。下面提供的代码就我所知。任何帮助将不胜感激!
Dim WordApp As Object
On Error GoTo APPLICATION_CREATE ' An error will cause us to initiate the Appl.
WordApp = GetObject(, "Word.Application")
GoTo SKIP_APPLICATION_CREATE 'If it is already there, then using that
APPLICATION_CREATE:
WordApp = CreateObject("Word.Application")
SKIP_APPLICATION_CREATE:
On Error GoTo BYE ' Back to our normal way of life
WordApp.Visible = True
WordApp.Activate()
wrdDoc = WordApp.Documents.Add
WordApp.Application.ScreenUpdating = False
WordApp.Application.ScreenUpdating = True
WordApp.Selection.HomeKeyUnit = wdStory()
BYE: