ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Workbook with Password using SaveChange (https://www.excelbanter.com/excel-programming/425379-saving-workbook-password-using-savechange.html)

Mouimet

Saving Workbook with Password using SaveChange
 
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

Dave Peterson

Saving Workbook with Password using SaveChange
 
This worked for me in xl2003:

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



Mouimet wrote:

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


--

Dave Peterson

Mouimet

Saving Workbook with Password using SaveChange
 
Thanks it's working fine. Have a nice day

"Dave Peterson" wrote:

This worked for me in xl2003:

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



Mouimet wrote:

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


--

Dave Peterson



All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com