你需要引用 Microsoft Word 10.0 Object Library 对象库在工程中。然后在程序里定义Dim WordApp As Word.Application Dim WordDoc As Word.Document
我是这样写的: Dim wrdApp As Word.Application Set wrdApp = New Word.Application With wrdApp 'Show Word .Visible = True 'Create New Document .Documents.Add 'Add text to the document .ActiveDocument.Content.Text = "Hi" .ActiveDocument.Content.Text = "This is a test example" .ActiveDocument.Content.Text = "success" End With但是最后显示了两个word,第一是个空的,第二个显示了:success,把"Hi"和"This is a test example"覆盖掉了。怎么回事???我的需求:我现在要显示成类似表格的形式,有多行,但只有两列。 这样的要求进行写的话该怎么写 ?
.ActiveDocument.Content.Text = "This is a test example"& vbcrlf 这就有回车了啊
Dim WordDoc As Word.Document
Dim wrdApp As Word.Application
Set wrdApp = New Word.Application
With wrdApp
'Show Word
.Visible = True
'Create New Document
.Documents.Add
'Add text to the document
.ActiveDocument.Content.Text = "Hi"
.ActiveDocument.Content.Text = "This is a test example"
.ActiveDocument.Content.Text = "success"
End With但是最后显示了两个word,第一是个空的,第二个显示了:success,把"Hi"和"This is a test example"覆盖掉了。怎么回事???我的需求:我现在要显示成类似表格的形式,有多行,但只有两列。
这样的要求进行写的话该怎么写 ?