Password protect Access gen xls file

J

jimtotem

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
 
C

Conrad

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
 
J

jimtotem

I'm not confident in "manipulating" the VBA code to achieve the password
insertion.

Jim
 
J

John Nurick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top