I have an application on access that export the data to word.
I did a query and the data export to word
my code is:
my question:
I want to export the data to a table in word.
I attach the file
(to work good put the file "doc3.doc" to "c:/")
how can I do it?
thanks
I did a query and the data export to word
my code is:
Code:
Dim db, rst
Dim strSQL As String
Set db = CurrentDb
'÷éùåø åôúéçú ååøã, åäöâúå áöåøä îåñøú
Dim objWord 'As Word.Application
'Set word as an application and make it invisible
Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible
'ùí äîñîê
objWord.Documents.Add ("C:\doc3.doc")
strSQL = Me.strSQL
Set rst = db.OpenRecordset(strSQL)
rst.MoveFirst
Dim strString As String
strString = ""
Do While Not rst.EOF
'ID---------------------------------
strString = strString & rst!nameID & vbTab & vbTab & "|"
'name-------------------------------
If Not IsNull(rst!fName) Then
strString = strString & rst!fName & vbTab & vbTab & "|"
End If
'lName---------------------------------
If Not IsNull(rst!lName) Then
strString = strString & rst!lName & vbTab & vbTab & "|"
End If
rst.MoveNext
strString = strString & vbCrLf
Loop
objWord.ActiveDocument.Bookmarks("aaa").Select
objWord.Selection.Text = strString
objWord.Visible = True
I want to export the data to a table in word.
I attach the file
(to work good put the file "doc3.doc" to "c:/")
how can I do it?
thanks