Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27209

From textbox to Word document

$
0
0
i found something to write text from a textbox to a textfield in a Word doc , but it is not working.

The field i called Text1

It opens the Word doc but that it , what am i doing wrong ?

Or maybey a link to what is working .

Code:

Dim MyApp1 As Object
        Dim MyDoc1 As Object
        MyApp1 = CreateObject("Word.Application")
        MyDoc1 = MyApp1.Documents.Open("C:\test" & "\test.docx")
        MyDoc1.Variables("Text1").Value = TextBox1.Text
        MyDoc1.Fields.Update()
        MyDoc1.Fields.Unlink()
        MyApp1.Visible = True


Viewing all articles
Browse latest Browse all 27209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>