Access generated xls file - psw protect?

  • 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
 
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
 
Back
Top