EXCEL Write into procted file

'''Script to create a new excel file , write data

'''save the file with read and write protected
'''''pwd1 is for read protected pwd2 is for write protected

Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Add
xl.DisplayAlerts=False
Set ws=wb.Worksheets("sheet1")
ws.cells(1,1)=100
ws.cells(1,2)=200
wb.Saveas "e:\data2.xls",,"pwd1","pwd2"
wb.Close
Set xl=nothing


'''Script to open excel file ,which is read and write protected write data
'''''pwd1 is for read protected pwd2 is for write protected

Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("e:\data2.xls",0,False,5,"pwd1","pwd2")
xl.DisplayAlerts=False
Set ws=wb.Worksheets("sheet1")
ws.cells(1,2)="hello"
ws.cells(2,2)="new data"
wb.Save
wb.Close
Set xl=nothing

Comments