Set password on existing excel application
-
Hi, I've been trying to set security password on a existing excel, and been trying these codes: Im Using COM for Excel 5.0 Public myExcel As Excel.Application Public myBook As Excel.Workbook Public mySheet As Excel.Worksheet myExcel = CreateObject("Excel.Application") xlsFilename = "C:\samp.xls" myBook = myExcel.Workbooks.open(xlsFilename) myBook.SaveAs(xlsFilename, password:=txt_password.Text) error that i'm getting is "Member not found" and points to myBook = myExcel.Workbooks.open(xlsFilename) when i try to look at the intellisense after workbooks. the only thing that appears is Gettype. Any other approach? or recommendation for this would be appreciated. Thanks.
-::maximus::-
-
Hi, I've been trying to set security password on a existing excel, and been trying these codes: Im Using COM for Excel 5.0 Public myExcel As Excel.Application Public myBook As Excel.Workbook Public mySheet As Excel.Worksheet myExcel = CreateObject("Excel.Application") xlsFilename = "C:\samp.xls" myBook = myExcel.Workbooks.open(xlsFilename) myBook.SaveAs(xlsFilename, password:=txt_password.Text) error that i'm getting is "Member not found" and points to myBook = myExcel.Workbooks.open(xlsFilename) when i try to look at the intellisense after workbooks. the only thing that appears is Gettype. Any other approach? or recommendation for this would be appreciated. Thanks.
-::maximus::-
In office XP I do it like so: xlSheet.Protect(Password:="SomePassWord", _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ UserInterfaceOnly:=True, _ AllowFormattingCells:=True, _ AllowFormattingColumns:=False, _ AllowFormattingRows:=False, _ AllowInsertingColumns:=False, _ AllowInsertingRows:=True, _ AllowInsertingHyperlinks:=False, _ AllowDeletingColumns:=False, _ AllowDeletingRows:=True, _ AllowSorting:=True, _ AllowFiltering:=True, _ AllowUsingPivotTables:=False) Its not necessary to have all the following settings, but I like to leave them there
-
In office XP I do it like so: xlSheet.Protect(Password:="SomePassWord", _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ UserInterfaceOnly:=True, _ AllowFormattingCells:=True, _ AllowFormattingColumns:=False, _ AllowFormattingRows:=False, _ AllowInsertingColumns:=False, _ AllowInsertingRows:=True, _ AllowInsertingHyperlinks:=False, _ AllowDeletingColumns:=False, _ AllowDeletingRows:=True, _ AllowSorting:=True, _ AllowFiltering:=True, _ AllowUsingPivotTables:=False) Its not necessary to have all the following settings, but I like to leave them there
Office XP has Interop, but im running this application in NT... if I can have it work without installing DLLs would be much better.
-::maximus::-