Hi guys,
I need to put the results of a query to an acces database onto a word document. now the query is driven by user choices so it might return one record or it might return over 300 records or then again, nothing at all. but if there is at least one record returned, this is needed to be desplayed on a word document that is going to have to be designed on the fly in code. since I am new to programming (not a student, working!!) i would like some help on this please. i have got as far as getting the info out of the database, just need help on putting it into a word document.
I've a code that acts like the similar way u want.Try this code.I think it will give u an idea how to do word writing from vb programs.If u still have problems then mail me.My email id is :
choudhuryshouvik@yahoo.com
Insert the following references into your project before trying to run this code :
Microsoft Word <version no> Object Library
from Project->References
Here is the code:-
'add a textbox(text1).also add two command buttons and name 'them cmdclose & cmdword respectively.
Option Explicit
Dim wrdapp As Word.Application
Private Sub cmdclose_Click()
On Error GoTo cerror
wrdapp.ActiveDocument.Close
wrdapp.Quit
cerror:
If Err.Number = 4198 Then
Dim ex As Integer
ex = MsgBox("Do you want to save this file …