By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

VB.net inserting a field into a word document

P: n/a
Ok, im lost.

Im trying to insert a field with the fields.add but I cant get i to work.
Can someone show me how it should look?

at the moment im running this code, just to create the document and insert a
line of text.

----
Imports Word
Imports Microsoft.Office.Core
----
Dim oWordApp As Object
Dim oWordDoc As Object
oWordApp = CreateObject("Word.Application")
oWordApp.Documents.Add.SaveAs(FileName:="c:\test7. doc")
oWordDoc = CreateObject("Word.Document")
oWordDoc = oWordApp.ActiveDocument
oWordDoc.Range.InsertAfter("This is a Word Document Test!!!!")

oWordDoc.Save()
oWordDoc.Close()

oWordApp.Quit()

oWordApp = Nothing
oWordDoc = Nothing

Hope some can help me

Kim
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.