ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them (https://www.excelbanter.com/excel-programming/359901-password-removal-i-have-password-open-file-password-modify-file-now-how-remove-them.html)

LJ[_4_]

PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them
 
I have the password to open the file and the password to modify the
file and I have the file open in my code, NOW how do I remove the
passwords or set to an empty string value so I don't have to enter a
password when I open this file manually?

Dim ExcelApp As Excel.Application
Dim ExcelWB As Excel.Workbook
Dim hasPassword As Boolean
Dim ExcelSheet As Excel.Worksheet
Dim savePassword As String
Dim newPassword As String = ""
Dim wrbk As _Workbook
wrbk.Password = newPassword

savePassword = "LARRY"





ExcelApp = New Excel.Application
ExcelApp.DisplayAlerts = False
ExcelWB = ExcelApp.Workbooks.Open("MyFilePath" Type.Missing,
Type.Missing, Type.Missing, savePassword, modifyPassword, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing)
ExcelWB.Application.Visible = True
ExcelApp.DisplayAlerts = True

HERE I WANT TO ADD CODE TO REMOVE THE PASSWORDS I SUPPLIED TO THE
OPEN() method from the XLS workbook it opened.( Programmatically) OR
set them to an empty STRING value. Whatever it takes to where I don't
have to enter any passwords when I open it manually. Any idea how to do
this?? sincerest gratitudes



ExcelWB.Save()
ExcelWB.Close()
ExcelWB = Nothing
ExcelApp.Quit()
ExcelApp = Nothing



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com