LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro code to change file-opening password


Good morning Arunjoshi

This code should help:

Sub Save1()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Book4.xls", Password:="password1"
Application.DisplayAlerts = True
Application.Quit
End Sub

When called this macro will save the file Book4.xls to the location C:\
with the password set as password1, irrespective of whether or not
another password was set to the file. The Application.Quit command
will then close Excel.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=379593

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel file opening password Manikandan[_2_] Excel Discussion (Misc queries) 2 March 6th 09 09:26 AM
Is there any way to be prompted for a password when opening a file Hamed parhizkar Excel Discussion (Misc queries) 2 November 29th 07 04:49 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. Daniel Excel Worksheet Functions 0 June 23rd 05 11:56 PM
Code to select 'Disable Macro' when opening an EXTERNAL FILE G rumpy O ld D uffer Excel Programming 1 March 22nd 05 05:32 PM


All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"