LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Open Password Protected XLS File

Follwing code will open pwd protected file if the pwd is right

Dim wk As Workbook
Set wk = Application.Workbooks.Open("C:\test.xls", , , , "testpwd", True)
'True is required for editing the file

wk.Password = "newpwd"
wk.Save
wk.Close

For unprotected files use this and tehn set pwd
Dim wk As Workbook
Set wk = Application.Workbooks.Open("C:\test.xls", True)


wk.Password = "newpwd"
wk.Save
wk.Close
 
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 Macro to open password protected workbooks? DBM[_2_] Excel Discussion (Misc queries) 3 March 30th 07 04:48 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 do I save a password protected Excel doc in order to open? Stamperfiend Excel Discussion (Misc queries) 4 August 25th 05 11:56 PM
Multiple workbook user's with Master workbook - all password protected Yvon Excel Discussion (Misc queries) 2 March 30th 05 01:34 PM
Can one open a password protected Lotus 1-2-3 (wk4) file from Exce FCZ Excel Discussion (Misc queries) 0 January 3rd 05 09:03 PM


All times are GMT +1. The time now is 10:32 PM.

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"