Hi All,
I need assistance on how to manupulate the Word Object through access.
This is pretty urgent b'cos I have to complete this application soon.
The following is part of the code that I'm working with. This is
currently implemented & therefore I have to work with this code.
In the code the section:
docFlette0.MailMerge.Execute
produces many documents depending on the situation (& at run-time).
What I need to do here is to get it to be saved in pdf format instead of
printing. That can be done if I change the default printer to "PdfWriter"
that I have installed & by using the following line in the existing code.
docFlette0.MailMerge.Application.PrintOut
But my problem is that I need to give names to the documents that are
generated from the "Execute" statement. How can I do that? Please help me.
Thanks a lot.
Sudharshan.
The code:
Dim db As Database
Dim Tabell0 As Recordset
Dim Tabell2 As Recordset
Dim Tabell4 As Recordset
Dim Tabell6 As Recordset
Dim Tabell8 As Recordset
Dim deb As Integer
Dim wdApp As Word.Application
Set db = CurrentDb
Set Tabell0 = db.OpenRecordset("IPRN_Fisk_Vertsreg")
Set Tabell2 = db.OpenRecordset("IPRN_Fisk_WishesToUniverity")
Set Tabell4 = db.OpenRecordset("IPRN_Fisk_OfferHost")
Set Tabell6 = db.OpenRecordset("IPRN_Fisk_ContractUniversity")
Set Tabell8 = db.OpenRecordset("IPRN_Fisk_FakturaVert")
'Set deb = 1 for debugging modus! (msgbox will appear at different
states)
deb = 0
[Tekst0] = Tabell0.RecordCount
[Tekst2] = Tabell2.RecordCount
[Tekst4] = Tabell4.RecordCount
[Tekst6] = Tabell6.RecordCount
[Tekst29] = Tabell8.RecordCount
Set wdApp = New Word.Application
If Tabell0.RecordCount > 0 Then
Dim docFlette0 As Word.Document
Set docFlette0 = wdApp.Documents.Open
("F:\AtlantisDB\Brev\Fisk\VertRegistrert.Doc")
docFlette0.MailMerge.Execute
docFlette0.MailMerge.Application.PrintOut
docFlette0.Close wdDoNotSaveChanges
End If