Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

HELP! HOW TO:Protect & Unprotect VBE Editor XL97-2000

Visto 195 veces
Saltar al primer mensaje no leído

RL

no leída,
25 may 2001, 11:43:2425/5/01
a
I have some routines that imports new code into an excel workbook using the VBE
object. The problem is that I want to project to be protected and I can not
import the code if it is.

Question: How can I programmticaly lock and unlock a VBE project?

I can find no objects except the read-only protection and no documentation about
this? Please help.

Thanks
-R-

RL

no leída,
25 may 2001, 11:43:2025/5/01
a

John Walkenbach

no leída,
25 may 2001, 12:59:1925/5/01
a
As far as I know, the only possible way to do this is to use SendKeys. The
object model does not allow access to this area -- presumably to thwart
password-cracking utilities.

John Walkenbach
For Excel tips, macros, & downloads...
http://j-walk.com/ss


"RL" <rl...@migkap.com> wrote in message
news:118b01c0e531$6f15ed00$9ee62ecf@tkmsftngxa05...

Joe McArthur

no leída,
25 may 2001, 13:10:3125/5/01
a
RL wrote in message <11ef01c0e531$6c80ea40$a4e62ecf@tkmsftngxa06>...

>I have some routines that imports new code into an excel workbook using the
>VBE object. The problem is that I want to project to be protected and I can
>not import the code if it is.
>
>Question: How can I programmticaly lock and unlock a VBE project?

You can't.

>I can find no objects except the read-only protection and no documentation
>about this? Please help.

That's because they don't exist. Call Microsoft and give em what for.

Joe

Rocky McKinley

no leída,
25 may 2001, 18:20:2525/5/01
a
You can use sendkeys to unlock the project, although I haven't tried to
relock it but I'm sure you'll get the idea by the code below (courtesy of
this news group).

The code is placed in the workbook open event and it only unlocks the
project if the user name is correct. You can just get rid of the if / end
if part of the routine for your purposes.

Sub UnlockProject() 'Workbook Open Event
dim v as string
v = Application.UserName
If v = "aaa" Or v = "rlm" Then

With Application
' OPEN VB EDITOR
.SendKeys "%{F11}", True

' TOOLS
.SendKeys "%T", True

' PROJECT PROPERTIES
.SendKeys "E", True

.SendKeys "mypassword" ' PASSWORD
.SendKeys "~", True ' ENTER
.SendKeys "~", True ' ENTER

' CLOSE THE EDITOR.
.SendKeys "%FC"
End With
End If
End Sub


Regards Rocky

0 mensajes nuevos