FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV 2024
→
WD: Protect an Excel file with Passord
WD: Protect an Excel file with Passord
Iniciado por Gianni Spano, 21,oct. 2010 19:43 - 2 respuestas
Conéctese…
Gianni Spano
#1
Publicado el 21,octubre 2010 - 19:43
Hello
I have over 120 excel files to protect with the same password.
These files are created with WD, reading each record (one for every excel file)
from a customer file and because the context of each file is private, i need to secure these files with a password. Every time a user try to open a file, it must prompt to input a known password.
Does someone have a solution to set a password during the step
when i generate the excel file?
Below there is a little solution i have found in Visual Basic:
Sub ProtectFile()
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For i = 1 To nombre
Worksheets(i).Protect , password:="blabla"
Next i
End Sub
Sub UnProtetFile()
' unprotect all sheets
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For i = 1 To nombre
Worksheets(i).Unprotect , password:="blabla"
Next i
TIA
Gianni
Informar
0
0
Paulo Oliveira
#2
Publicado el 22,octubre 2010 - 01:58
I didn't test it but this code and your explanation don't seems to match.
NOTE: the code that I am suggesting is untested. I don't have access to WinDev, i'm at home (today at least i leave the office at a decent hour).
to translate this code to Wlanguage use something like this:
m_xExcel is object OLE dynamic
m_xExcel=new object OLE "Excel.Application"
m_xExcel>>Workbooks>>Open("c:\myfiles\test.xls")
wint is int
wi is int
wint = m_xExcel>>ActiveWorkbook>>Sheets>>Count
FOR wi = 1 TO wint
m_xExcel>>Sheets( wi)>>Protect("aaa")
END
m_xExcel>>ActiveWorkbook>>Saveas("c:\myfiles\test_1.xls")
m_xExcel>>ActiveWorkbook>>close(False)
m_xExcel>>Quit()
delete m_xExcel
to do what you are asking use something like this:
m_xExcel is object OLE dynamic
m_xExcel=new object OLE "Excel.Application"
m_xExcel>>Workbooks>>Open("c:\myfiles\test.xls")
m_xExcel>>ActiveWorkbook>>Saveas("c:\myfiles\test_1.xls",*,"aaa")
m_xExcel>>ActiveWorkbook>>close(False)
m_xExcel>>Quit()
delete m_xExcel
Informar
0
0
Gianni Spano
#3
Publicado el 22,octubre 2010 - 09:28
Thanks Paulo
I will try your solution tomorrow morning..
Thanks again for your support..
:spos:
Gianni
Informar
0
0
→ Volver a WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto