![]() |
Save file without a password req
I have a folder of files, which I want to open and save with the same name, however without a password.. How can I do this? Thanks -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=480580 |
Save file without a password req
This is the code, however it doesn't work, as the file still asks for a password when I open it. The code: Application.DisplayAlerts = False ActiveWorkbook.SaveAs FileName:= _ "X:\Users\Shared\GENERAL\Christian S\05.10.28 - Budget packs - Capital expenditure - comments\" & Aworkbook _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=480580 |
Save file without a password req
Do they all have the same password? If they're different, do you have a list of
the filenames and file passwords? This worked ok for me with a common password: Option Explicit Sub testme() Dim myFileNames As Variant Dim iCtr As Long Dim wkbk As Workbook Dim myCommonPassword As String myCommonPassword = "asdf" myFileNames = Application.GetOpenFilename _ ("Excel Files,*.xls", MultiSelect:=True) If IsArray(myFileNames) = False Then Exit Sub 'user hit cancel End If For iCtr = LBound(myFileNames) To UBound(myFileNames) Set wkbk = Nothing On Error Resume Next Set wkbk = Workbooks.Open(Filename:=myFileNames(iCtr), _ Password:=myCommonPassword) On Error GoTo 0 If wkbk Is Nothing Then MsgBox myFileNames(iCtr) & " wasn't opened!" Else Application.DisplayAlerts = False wkbk.SaveAs Filename:=myFileNames(iCtr), Password:="" Application.DisplayAlerts = True wkbk.Close savechanges:=False End If Next iCtr End Sub Ctech wrote: I have a folder of files, which I want to open and save with the same name, however without a password.. How can I do this? Thanks -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=480580 -- Dave Peterson |
Save file without a password req
I have a folder with workbooks, (some of the workbooks are file protected with a password) What I want the macro to do is, open one workbook at a time, if it asks for a password, I will then manually type it in. Then the macro is to save and overwrite the earlier version of the workbook. Then go to the next file in the folder. This macro is there just to make it easier for the other macroes which I'm running on the same workbooks in that folder. I can't be asked to type in these stupid passwords each time I need some data.. The best would be if the macro could find the password itself(hack the files), but I guess that's harder. -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=480580 |
Save file without a password req
How about this version with minor updates:
Option Explicit Sub testme() Dim myFileNames As Variant Dim iCtr As Long Dim wkbk As Workbook myFileNames = Application.GetOpenFilename _ ("Excel Files,*.xls", MultiSelect:=True) If IsArray(myFileNames) = False Then Exit Sub 'user hit cancel End If For iCtr = LBound(myFileNames) To UBound(myFileNames) Set wkbk = Nothing On Error Resume Next Set wkbk = Workbooks.Open(Filename:=myFileNames(iCtr)) On Error GoTo 0 If wkbk Is Nothing Then MsgBox myFileNames(iCtr) & " wasn't opened!" Else Application.DisplayAlerts = False wkbk.SaveAs Filename:=myFileNames(iCtr), Password:="" Application.DisplayAlerts = True wkbk.Close savechanges:=False End If Next iCtr End Sub Ctech wrote: I have a folder with workbooks, (some of the workbooks are file protected with a password) What I want the macro to do is, open one workbook at a time, if it asks for a password, I will then manually type it in. Then the macro is to save and overwrite the earlier version of the workbook. Then go to the next file in the folder. This macro is there just to make it easier for the other macroes which I'm running on the same workbooks in that folder. I can't be asked to type in these stupid passwords each time I need some data.. The best would be if the macro could find the password itself(hack the files), but I guess that's harder. -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=480580 -- Dave Peterson |
All times are GMT +1. The time now is 07:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com