Access Module, Saving an Excel sheet with a password

  • Thread starter Andre L via AccessMonster.com
  • Start date
A

Andre L via AccessMonster.com

Sometime ago I set up a module to open an Excel Template, refresh the sheets
and save the book to a share. Now I need to stick a password on the file to
be saved. Would anyone know the syntax? Here is the current code:

Dim xcelapp As Object
Set xcelapp = CreateObject("Excel.Application")
xcelapp.Workbooks.Open TemplateBook
xcelapp.DisplayAlerts = False
xcelapp.ActiveWorkbook.RefreshAll

xcelapp.ActiveWorkbook.SaveAs Filename:=NewBook
xcelapp.ActiveWorkbook.Close
 
C

Crystal

Hi Andre

ActiveWorkbook.Protect "password"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
(e-mail address removed)
 
A

Andre L via AccessMonster.com

I figured it was something simple---THANKS!!!
Hi Andre

ActiveWorkbook.Protect "password"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
(e-mail address removed)
Sometime ago I set up a module to open an Excel Template, refresh the sheets
and save the book to a share. Now I need to stick a password on the file to
[quoted text clipped - 8 lines]
xcelapp.ActiveWorkbook.SaveAs Filename:=NewBook
xcelapp.ActiveWorkbook.Close
 
C

Crystal

You're welcome, Andre ;)

I usually use a convoluted function to return "password" so
it is not easy to figure out if someone gets into the code
and does a search

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


I figured it was something simple---THANKS!!!
Hi Andre

ActiveWorkbook.Protect "password"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
(e-mail address removed)

Sometime ago I set up a module to open an Excel Template, refresh the sheets
and save the book to a share. Now I need to stick a password on the file to

[quoted text clipped - 8 lines]
xcelapp.ActiveWorkbook.SaveAs Filename:=NewBook
xcelapp.ActiveWorkbook.Close
 

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

Similar Threads


Top