hi everyone, im trying to create what seems like a pretty straightfoward little app. I basically want the user to be able to select text from listboxes etc from a form and then insert the text at the desired location in a word 2000 document. im using docvariables in the document and i have the following code
i can find the docvariables ok, what i cant figure out is how to access the docvariables properties via the field object. is some sort of cast required or what? I may be totally headed in the wrong direction here so please feel free to point me in the right one.
Thanks,
Kris.
Code:
Public Class Xdocument
Shared wordapp As Word.ApplicationClass
Shared worddoc As Word.Document
Shared wordrange As Word.Range
Shared wordbk As Word.Bookmark
Shared wordpara As Word.Paragraph
Shared fld As Word.Field
Shared dv As Word.Variable
Shared Function addsometext(ByVal text As String) As Boolean
Try
wordapp = New Word.ApplicationClass
wordapp.Documents.Open("e:\vb\testdoc.doc")
wordrange = wordapp.ActiveDocument.Range
For Each fld In wordapp.ActiveDocument.Fields
If fld.Type = Word.WdFieldType.wdFieldDocVariable Then
if variables name is "something" then
"insert some text here"
End If
Next
Thanks,
Kris.