Forums Últimos mensajes - Powered by IBM
 
Tags Palabras claves

Protejer xls

20/10/2005 - 15:20 por rickpt | Informe spam
Hola

Estoi grabando un fichero xls e quiero lo quiero protejer. Para eso estoy usando l
siguiente scrip

<SCRIPT LANGUAGE="VBScript
Function CreateExcel(
Dim sTemplat
Dim xlAp
Dim xlBoo
Dim xlShee
Set xlApp = CreateObject("Excel.Application"
xlApp.DisplayAlerts = Fals
sTemplate = “http://localhost/easyDoc/TrackingDocStatus.xls
xlApp.DisplayAlerts = Fals
xlApp.Workbooks.Open sTemplat
Set xlBook = xlApp.Workbooks(1
Set xlSheet = xlBook.Sheets("Per Status"
xlSheet.Cells(1‚2)="Process Description
xlSheet.Cells(1‚3)="Process Instruction
xlSheet.Cells(1‚4)="Technical Specification
xlSheet.Cells(1‚5)="Template
xlSheet.Cells(1‚6)="External Document
xlSheet.Cells(2‚1)="Being Created
xlSheet.Cells(3‚1)="Being Reviewed
xlSheet.Cells(4‚1)="Being Approved
xlSheet.Cells(5‚1)="Waiting Release
xlSheet.Cells(6‚1)="16
xlSheet.Cells(7‚1)="4
xlSheet.Cells(8‚1)="11
xlSheet.Cells(9‚1)="0
xlSheet.Cells(2‚2)="94
xlSheet.Cells(3‚2)="17
xlSheet.Cells(4‚2)="10
xlSheet.Cells(5‚2)="0
xlSheet.Cells(2‚3)="10
xlSheet.Cells(3‚3)="6
xlSheet.Cells(4‚3)="37
xlSheet.Cells(5‚3)="2
xlSheet.Cells(2‚4)="13
xlSheet.Cells(3‚4)="3
xlSheet.Cells(4‚4)="4
xlSheet.Cells(5‚4)="0
xlSheet.Cells(2‚5)="0
xlSheet.Cells(3‚5)="0
xlSheet.Cells(4‚5)="0
xlSheet.Cells(5‚5)="0

xlApp.DisplayAlerts = Fals
xlBook.SaveAs ("c:\inetpub\wwwroot\easyDoc\templatesXls\TrackingDocStatus.xls"
xlApp.Visible = tru
Set xlSheet = Nothin
Set xlSheet2 = Nothin
Set xlBook = Nothin
Set xlApp = Nothin
end functio
</SCRIP

Esta es la script que estoi usando para grabarlo pero antes queria protejerlo contra escrita (write protect) de modo a evitar que sea alterado. Alguien sabe que comando debo utilizar

Gracia

rickpt

Ver este tema: http://www.softwaremix.net/viewtopic-445535.htm

Enviado desde http://www.softwaremix.net
 

Leer las respuestas

#1 Miguel Gonzalez
20/10/2005 - 16:07 | Informe spam
Hola Rickpt

Para proteger/desproteger una hoja utiliza:

xlSheet.Protect Password:= "hola123", DrawingObjects:=True,
Contents:=True, Scenarios:=True

xlSheet.Unprotect

Para proteger/desproteger el libro:

xlBook.Protect Password:= "hola123", Structure:=True, Windows:=True

xlBook.Unprotect


Si no pones la contraseña el usuario podra proteger/desproteger el libro
u hoja cuando quiera.

Saludos!
Miguel

rickpt escribió:
Hola‚

Estoi grabando un fichero xls e quiero lo quiero protejer.&#8194;Para eso estoy usando la
siguiente script

<SCRIPT LANGUAGE="VBScript"
Function CreateExcel()
Dim sTemplate
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
sTemplate = “http://localhost/easyDoc/TrackingDo....xls"
xlApp.DisplayAlerts = False
xlApp.Workbooks.Open sTemplate
Set xlBook = xlApp.Workbooks(1)
Set xlSheet = xlBook.Sheets("Per Status")
xlSheet.Cells(1‚2)="Process Description"
xlSheet.Cells(1‚3)="Process Instruction"
xlSheet.Cells(1‚4)="Technical Specification"
xlSheet.Cells(1‚5)="Template"
xlSheet.Cells(1‚6)="External Document"
xlSheet.Cells(2‚1)="Being Created"
xlSheet.Cells(3‚1)="Being Reviewed"
xlSheet.Cells(4‚1)="Being Approved"
xlSheet.Cells(5‚1)="Waiting Release"
xlSheet.Cells(6‚1)="16"
xlSheet.Cells(7‚1)="4"
xlSheet.Cells(8‚1)="11"
xlSheet.Cells(9‚1)="0"
xlSheet.Cells(2‚2)="94"
xlSheet.Cells(3‚2)="17"
xlSheet.Cells(4‚2)="10"
xlSheet.Cells(5‚2)="0"
xlSheet.Cells(2‚3)="10"
xlSheet.Cells(3‚3)="6"
xlSheet.Cells(4‚3)="37"
xlSheet.Cells(5‚3)="2"
xlSheet.Cells(2‚4)="13"
xlSheet.Cells(3‚4)="3"
xlSheet.Cells(4‚4)="4"
xlSheet.Cells(5‚4)="0"
xlSheet.Cells(2‚5)="0"
xlSheet.Cells(3‚5)="0"
xlSheet.Cells(4‚5)="0"
xlSheet.Cells(5‚5)="0"

xlApp.DisplayAlerts = False
xlBook.SaveAs ("c:\inetpub\wwwroot\easyDoc\templatesXls\TrackingDocStatus.xls")
xlApp.Visible = true
Set xlSheet = Nothing
Set xlSheet2 = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
end function
</SCRIPT

Esta es la script que estoi usando para grabarlo pero antes queria protejerlo contra escrita (write protect) de modo a evitar que sea alterado. Alguien sabe que comando debo utilizar.

Gracias


Preguntas similares