G
Guest
I would like to use VBA to open a protected Excel File.
Can't seem to get the arguements correct.
Any ideas?
Here is my code -
Sub UnProtectFile(ByVal sFilename)
Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook
'Open the file
Set xlBook = xlApp.Workbooks.Open(sFilename, , False, , "xxxyyy", False,
True)
'Set the file for read only
xlApp.Application.DisplayAlerts = False
xlBook.SaveAs sFilename, , , , False
xlApp.Application.DisplayAlerts = True
xlBook.Close True
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
Can't seem to get the arguements correct.
Any ideas?
Here is my code -
Sub UnProtectFile(ByVal sFilename)
Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook
'Open the file
Set xlBook = xlApp.Workbooks.Open(sFilename, , False, , "xxxyyy", False,
True)
'Set the file for read only
xlApp.Application.DisplayAlerts = False
xlBook.SaveAs sFilename, , , , False
xlApp.Application.DisplayAlerts = True
xlBook.Close True
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
End Sub