Access generated xls file - psw protect?

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
 
T

TC

Perhaps you could open the new spreadsheet from Access VBA (using
automation) then use Excel methods to set the password:

(untested)

dim oExcel as object
set oExcel = createobject ("excel.application")
oExcel.open "C:/blah.xls"
oExcel.whatever-required-to-set-a-password
oExcel.Close ' .Quit?
set oExcel = nothing

HTH,
TC
 

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