D
dhoover via AccessMonster.com
I'm using the code below to export multiple reports and save then in a folder
using the client's name. This part works perfectly. What I need, however is
to add a password (the same one) to each file as it's being exported. Is
there a way to do this?
Dim strFolderPath As String
Dim strFolder5 As String
Dim strFolderPath5 As String
Dim rst As DAO.Recordset
Dim db As DAO.database
Dim objWord As Object
Set objWord = New Application
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from [customer info] where statusid=1;")
With rst
If Not (.EOF And .BOF) Then
MoveLast
MoveFirst
Do
'next line opens report for current customer
'DoCmd.OpenReport "Customer Instructions", acViewPreview, ,
DoCmd.OpenReport "Changes Made", acViewPreview, , "[CustomerID] = " & .Fields!
[CustomerID]
'next line sets path for current customer
strFolderPath = "G:\Changes Made" & "\" & rst!Customer
DoCmd.OutputTo acOutputReport, "changes made", acFormatRTF, strFolderPath & "
- Changes Made.doc", False
DoCmd.Close acOutputReport, "Changes made", False
MoveNext
Loop Until .EOF
End If
Close
End With
Set rst = Nothing
Set db = Nothing
using the client's name. This part works perfectly. What I need, however is
to add a password (the same one) to each file as it's being exported. Is
there a way to do this?
Dim strFolderPath As String
Dim strFolder5 As String
Dim strFolderPath5 As String
Dim rst As DAO.Recordset
Dim db As DAO.database
Dim objWord As Object
Set objWord = New Application
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from [customer info] where statusid=1;")
With rst
If Not (.EOF And .BOF) Then
MoveLast
MoveFirst
Do
'next line opens report for current customer
'DoCmd.OpenReport "Customer Instructions", acViewPreview, ,
DoCmd.OpenReport "Changes Made", acViewPreview, , "[CustomerID] = " & .Fields!
[CustomerID]
'next line sets path for current customer
strFolderPath = "G:\Changes Made" & "\" & rst!Customer
DoCmd.OutputTo acOutputReport, "changes made", acFormatRTF, strFolderPath & "
- Changes Made.doc", False
DoCmd.Close acOutputReport, "Changes made", False
MoveNext
Loop Until .EOF
End If
Close
End With
Set rst = Nothing
Set db = Nothing