How to create TEXTBOX in Microsoft WORDs to accept data from VB6 Screen.
Hi there,
I have been asked to develop VB6 application to create User Interface screen to allow Human Resource Dept staff to input Employee data. When the COMMAND button is clicked then transfer to data to official WORDS documents (template) for printing. I don't know how to create TEXTBOX in WORDS document itself to receive the data transferred from VB6 screen. The User doesn't want to use Mail Merge facilities within WORDS itself.
Please help me out.
Enclosed are sample VB6 Interface Screen and WORDS document.
[558 byte] By [
Lennie] at [2007-11-11 11:57:34]

# 4 Re: How to create TEXTBOX in Microsoft WORDs to accept data from VB6 Screen.
Hi Hack and all,
As promised, I got my program running now using Mr Hack suggestion and examples obtained from other internet sites. Here are copy of my VB6 script.
Here are the steps to get it going.
WORDs Document.
1. determine the location in the WORD's document where you want to place the BookMark.
2. Click your cursor there and create the bookmark by selecting Menu/Insert/Bookmark.
dim oWord as Word.application
dim odoc as Word.documents
Private Function FGetIEAIndefinteTermToWord()
On Error GoTo Err_Word
Set oWord = New Word.Application
Set oDoc = oWord.Documents.Open(strDestination, , ReadOnly:=False)
oDoc.Activate
With oWord
FUpdateBookMark "bmFullName", txtFirstName.Text & " " & txtLastName.Text
FUpdateBookMark "bmFullName2", txtFirstName.Text & " " & txtLastName.Text
FUpdateBookMark "bmFullName3", txtFirstName.Text & " " & txtLastName.Text
FUpdateBookMark "bmPosition", txtPosition.Text
FUpdateBookMark "bmPosition2", txtPosition.Text
FUpdateBookMark "bmPosition3", txtPosition.Text
FUpdateBookMark "bmWorkLocation", txtWorkLocation.Text
FUpdateBookMark "bmAnnualSalary", Format(txtAnnualSalary.Text, "currency")
FUpdateBookMark "bmExpiryDate", strTempDate
FUpdateBookMark "bmagreementDate", Format(txtDateAgreed, "dd/mm/yyyy")
End With
oWord.Visible = True
Exit_Function:
Set oWord = Nothing
Set oDoc = Nothing
Exit Function
Err_Word:
MsgBox Err.Description
Resume Exit_Function
End Function
Private Function FUpdateBookMark(ByVal bm As String, itext As String)
Dim bmrange As Range
Set bmrange = ActiveDocument.Bookmarks(bm).Range
bmrange.Text = itext
End Function
Private Function FCopyFile()
'copy original copy
strSource = "F:\VB6Practice\VB6MailMerge\BigFile.doc"
strDestination = "F:\VB6Practice\VB6MailMerge\IEACopy.doc"
FileCopy strSource, strDestination
End FunctionHave fun.
Lennie at 2007-11-11 17:23:54 >
