|
-
Dec 19th, 2002, 12:03 PM
#1
Thread Starter
Member
struggling to feed data into MSWORD thru VB.NET
I created Bookmarks in my word template pima.doc.I am trying to insert data into Bookmarks in word document by fetching data from MS Access thru VB.NET.
But when i try to write properties for word application ,it gives error.
same code work in VB6;
ie
objword.application.activedocument.bookmarks("today").range.insertafter Rs.Fields(1).Value.(this works fine in VB6)
But i could not write same line in VB.NET
what i have to do solve the problem.
Dim Rs As ADODB.Recordset
Rs = New ADODB.Recordset()
Dim conn As ADODB.Connection
conn = New ADODB.Connection()
Dim objword As Word.Application
objword = New Word.Application()
Dim sSQL As String
sSQL = "SELECT * FROM pcAddress where Regid=1;"
Rs.Open("sSQL", conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic)
If Rs.BOF = True And Rs.EOF = True Then
MessageBox.Show("No Records Returned", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
objword.Application.Documents.Add("C:\ram\Address\pima\pima.doc", False)
objword.Visible = True
objword.Activate()
Please help me out.
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|