Saving Workbook with Password using SaveChange

M

Mouimet

Hi
The macro create different files and replace the existing files quietly when
the user
close the main file. I dont want the user to see a box asking to replace the
files.
My problem is, one of them need to be save with a password to open.
I tried ActiveWorkbook.Protect ("Password") before the line
Activeworkbook.close
and it doesn't work. I tried after, ssame thing.
I think my problem is when I use the saveChange.
Do you have a solution. Thanks
Here part of the macro I'm using:
==========
' save file telephones

Application.DisplayAlerts = False
ActiveWorkbook.Close SaveChanges:=True,
Filename:="G:\2009\Infos\Telephones.xls"
Application.DisplayAlerts = True

' macro continue
 
D

Dave Peterson

This worked for me in xl2003:

Option Explicit
Sub testme()
With ActiveWorkbook
.Password = "hi"
.Close savechanges:=True
End With
End Sub
 
M

Mouimet

Thanks it's working fine. Have a nice day

Dave Peterson said:
This worked for me in xl2003:

Option Explicit
Sub testme()
With ActiveWorkbook
.Password = "hi"
.Close savechanges:=True
End With
End Sub
 

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