I am building an application in VB.Net using Visual Studio Express Edition 2008. My application interacts with a MS Word 2007 template. I have textboxes in the application that write user input from a form within my application to bookmarks in the Word
template on a button click event without issue using the following code:
Imports
Microsoft.Office.Interop
Public Class Form1
Private Sub Button1_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles Button1.Click
Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and Open document template
oWord = CreateObject("Word.Application")
oWord.Visible =
True
oDoc = oWord.Documents.Add("C:\Documents And Settings\Admin\My Documents\Template Form.dotx ")
"Address").Range.Text = TextBox3.Text
Me.Hide()
End Sub
End Class
I am trying to figure out how instead or calling a book mark in Word you would call one of the content controls (a combobox, checkbox or text box) that are found under the developer menu in Word 2007 that has been inserted into the Word Template.
I think that it would be something like:
gram999
0 Points
1 Post
Using VB.Net to reference a checkbox in an MS Word 2007 doucment
Jul 21, 2008 02:48 PM|LINK
I am building an application in VB.Net using Visual Studio Express Edition 2008. My application interacts with a MS Word 2007 template. I have textboxes in the application that write user input from a form within my application to bookmarks in the Word template on a button click event without issue using the following code:
Imports
Microsoft.Office.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oDoc As Word.Document 'Start Word and Open document template oWord = CreateObject("Word.Application")oWord.Visible =
True oDoc = oWord.Documents.Add("C:\Documents And Settings\Admin\My Documents\Template Form.dotx ")oDoc.Bookmarks(
"FN").Range.Text = TextBox1.Text oDoc.Bookmarks("LN").Range.Text = TextBox2.TextoDoc.Bookmarks(
"Address").Range.Text = TextBox3.Text Me.Hide() End Sub End Class I am trying to figure out how instead or calling a book mark in Word you would call one of the content controls (a combobox, checkbox or text box) that are found under the developer menu in Word 2007 that has been inserted into the Word Template. I think that it would be something like:oDoc.ContentControls.Range.Text = TextBox1.Text
Thanks in advance for any ideas/assistance