我需要创建一个表单,数据必须从该表单传输到 MS Word 文档文本字段
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyApp1 As Object
Dim MyDoc1 As Object
MyApp1 = CreateObject("Word.Application")
MyDoc1 = MyApp1.Documents.Open(C:\DSU.docx")
MyDoc1.Field("w_VardasPavarde").Range = VardasPavarde.Text
MyDoc1.Fields.Update()
MyDoc1.Fields.Unlink()
MyApp1.Visible = True
End Sub
上面的代码打开 word 文档,但字段为空。寻求建议。