Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
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
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
bypass password when update linking of password protected file Yan Excel Discussion (Misc queries) 1 February 7th 05 11:29 PM
Excel marcos firing on file save as but not file save Andy Excel Programming 1 August 3rd 04 10:34 AM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM
Save protected file into unprotected file without password Paul Excel Programming 3 August 2nd 03 05:17 PM


All times are GMT +1. The time now is 12:31 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"