G
Guest
Hi
I have a word macro as follows....
================
Sub test()
Dim myDbase As Database
Dim myrst As DAO.Recordset
Dim myDbasePath, myDbaseTable, myDocPAth, myText As String
Dim temp
myDbasePath = "c:\db4.mdb"
myDbaseTable = "Table1"
myDocPAth = "c:\"
Set myDbase = OpenDatabase(myDbasePath)
Set myrst = myDbase.OpenRecordset(myDbaseTable)
myrst.MoveFirst
While myrst.EOF = False
myText = myrst.Fields(0) & " - " & myrst.Fields(1) & " " & myrst.Fields(2) &
" " & myrst.Fields(3)
Set temp = New Document
With temp
.PageSetup.DifferentFirstPageHeaderFooter = True
.Sections(1).Headers.Item(wdHeaderFooterFirstPage).Range.InsertAfter
(myText)
.SaveAs (myDocPAth & myrst.Fields(0).Value & ".doc")
.Close
End With
myrst.MoveNext
Wend
myrst.Close
End Sub
===============
It uses DAO. What I would like to be able to do is to get the macro to do
the same thing using ADO commands.
I have tried to find out the syntax of the Recordset.open command but, as
yet, have not come up with a solution.
Any help would be gratefully appreciated.
Many thanks
Malcolm
I have a word macro as follows....
================
Sub test()
Dim myDbase As Database
Dim myrst As DAO.Recordset
Dim myDbasePath, myDbaseTable, myDocPAth, myText As String
Dim temp
myDbasePath = "c:\db4.mdb"
myDbaseTable = "Table1"
myDocPAth = "c:\"
Set myDbase = OpenDatabase(myDbasePath)
Set myrst = myDbase.OpenRecordset(myDbaseTable)
myrst.MoveFirst
While myrst.EOF = False
myText = myrst.Fields(0) & " - " & myrst.Fields(1) & " " & myrst.Fields(2) &
" " & myrst.Fields(3)
Set temp = New Document
With temp
.PageSetup.DifferentFirstPageHeaderFooter = True
.Sections(1).Headers.Item(wdHeaderFooterFirstPage).Range.InsertAfter
(myText)
.SaveAs (myDocPAth & myrst.Fields(0).Value & ".doc")
.Close
End With
myrst.MoveNext
Wend
myrst.Close
End Sub
===============
It uses DAO. What I would like to be able to do is to get the macro to do
the same thing using ADO commands.
I have tried to find out the syntax of the Recordset.open command but, as
yet, have not come up with a solution.
Any help would be gratefully appreciated.
Many thanks
Malcolm