Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default changing a file password from something to nothing

I would like to save a file with a password and then later save the same file
in the same location and with the same name but remove the password. Does any
one know what the syntax should be. I'm new to VBA, but Excel seems to be
acting weird when I try to do this. Does anyone know why I can't just use
the SaveAs method and specify Password:="". The only way the code does work
is if I first changed the password to a string and then change it again to
nothing. It seems redundant. Maybe I've missed something.

This is the routine that finally worked:

Sub save_wo_passwd()
Application.DisplayAlerts = False
Fname = ActiveWorkbook.FullNameURLEncoded
ActiveWorkbook.SaveAs Filename:=Fname, _
FileFormat:=xlNormal, Password:="1234"
ActiveWorkbook.SaveAs Filename:=Fname, Password:=""
Application.DisplayAlerts = True
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default changing a file password from something to nothing

I can't see how you can have 2 workbooks with the same name in the same folder??

"Mike Gallagher" wrote in message
...
I would like to save a file with a password and then later save the same file
in the same location and with the same name but remove the password. Does any
one know what the syntax should be. I'm new to VBA, but Excel seems to be
acting weird when I try to do this. Does anyone know why I can't just use
the SaveAs method and specify Password:="". The only way the code does work
is if I first changed the password to a string and then change it again to
nothing. It seems redundant. Maybe I've missed something.

This is the routine that finally worked:

Sub save_wo_passwd()
Application.DisplayAlerts = False
Fname = ActiveWorkbook.FullNameURLEncoded
ActiveWorkbook.SaveAs Filename:=Fname, _
FileFormat:=xlNormal, Password:="1234"
ActiveWorkbook.SaveAs Filename:=Fname, Password:=""
Application.DisplayAlerts = True
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default changing a file password from something to nothing

Corey,
Sorry, I may have made it sound that way, but I only want to end up with
one version of the file. I just want to change it so that it is not password
protected. I'm actually doing this on a network with many similar files in
different locations. I want to get these files to their destinations, run a
series of routines on them, and then allow them to be opened by recipients.

"Corey" wrote:

I can't see how you can have 2 workbooks with the same name in the same folder??


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default changing a file password from something to nothing

Open it, providing the password, then do a SaveAs using the same name with
no password.

--
Regards,
Tom Ogilvy

"Mike Gallagher" wrote in message
...
Corey,
Sorry, I may have made it sound that way, but I only want to end up with
one version of the file. I just want to change it so that it is not
password
protected. I'm actually doing this on a network with many similar files in
different locations. I want to get these files to their destinations, run
a
series of routines on them, and then allow them to be opened by
recipients.

"Corey" wrote:

I can't see how you can have 2 workbooks with the same name in the same
folder??




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
changing a password protected file mellow Excel Discussion (Misc queries) 2 June 3rd 06 05:10 AM
PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them LJ[_4_] Excel Programming 0 April 27th 06 03:18 AM
changing password to **** praveen_khm[_41_] Excel Programming 4 April 20th 06 06:38 PM
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


All times are GMT +1. The time now is 11:53 PM.

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

About Us

"It's about Microsoft Excel"