|
-
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
-
Dec 20th, 2002, 10:59 AM
#2
Frenzied Member
I haven't tried to do something like this (yet) but perhaps you could take a VB6 example and convert it into VB.NET.
That would give you code that worked. And an idea of what you're doing wrong.
Just a suggestion.
~Peter

-
Dec 20th, 2002, 11:50 AM
#3
Addicted Member
-
Dec 20th, 2002, 11:56 AM
#4
Addicted Member
-
Dec 20th, 2002, 01:11 PM
#5
Thread Starter
Member
Okay.I will convert from VB to VB.NET.
Thanks for suggesions.
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
|