L
LJ
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
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