Password protect Access gen xls file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the following VBA code to create an Excel (xls) file from an
Access (2002) table:
DoCmd.SendObject acTable, temptable, "MicrosoftExcel(*.xls)", strToWhom, , ,
"" as of " & Date & " at " & Time(), "The attached file contains our latest
submittal.", intSeeOutlook
Is there a way to password protect the newly created xls file within my VBA
code? I would/could use a "fixed" password for all of the xls files created.
Thanks for your assistance,
Jim
 
I don't believe there is an option on the SendObject for this. How about
manipulating it using VBA code? Then you could add the password and send it
 
One way would be to use DoCmd.TransferSpreadsheet or DoCmd.OutputTo to
create the workbook as a disk file. You'd then use Automation to launch
Excel, open the workbook, and run Excel VBA code (in Access) that
protects the workbook and applies the password before closing it and
quitting Excel. Finally, your code would need to create an email and
attach the workbook to it (SendObject only works with attachments it
generates itself. These links should get you started, along with Excel's
Help and macro recorder.

http://www.mvps.org/access/modules/mdl0006.htm
http://support.microsoft.com/?id=210148

http://www.granite.ab.ca/access/email.htm
 
Back
Top