我想通过保存按钮将文本框中的文字输出到word文档中,开始运行的很好,但后来改动界面后不知怎么不行了。
同样的代码在word宏中也是有时可以运行,有时就进行不下去。
请大侠多指教!
程序界面和程序编辑界面分别如上!
代码如下:
Private Sub Command1_Click()
AddOut_Word
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text4.Text = Val(Text3.Text) * 3
Label1.Caption = "m3/h"
End Sub
Private Sub Form_Load()
Text1.Text = "酸浸矿浆"
Text2.Text = "2007-10-1"
Text3.Text = "10"
Text4.Text = ""
End Sub
Public Sub AddOut_Word() '定义的一个调用过程
Dim wdapp As Word.Application
Dim wddoc As Word.Document
'创建Word应用程序
Set wdapp = CreateObject("Word.application")