Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. | Excel Worksheet Functions | |||
bypass password when update linking of password protected file | Excel Discussion (Misc queries) | |||
Excel marcos firing on file save as but not file save | Excel Programming | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming | |||
Save protected file into unprotected file without password | Excel Programming |