Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I Protect/Unprotect VBA Project programmatically?

39 views
Skip to first unread message

Kirill Lapin

unread,
Aug 19, 2001, 1:47:05 PM8/19/01
to
Can anybody please help me to figure out how to Protect/Unprotect VBA
Projects programmatically.

Many thanks,
Kirill.


Harald Staff

unread,
Aug 19, 2001, 3:03:47 PM8/19/01
to
Hi Kirill

You can't, sorry, except with "sendkeys". Search this at
http://groups.google.com/advanced_group_search

("Can't" is; there are no objects in VB /VBA that approaches this lock. If
you use some tool to alter the binary structure of the stored file, and
manage to figure out where and what the possibly encrypted password is, it
might in theory be possible. )

Best wishes Harald


"Kirill Lapin" <lap...@grupobbv.net> wrote in message
news:OCm$qWNKBHA.1268@tkmsftngp05...

Tom Ogilvy

unread,
Aug 19, 2001, 3:12:39 PM8/19/01
to
It is not supported in Excel VBA beyond using SendKeys.

Regards,
Tom Ogilvy

Kirill Lapin <lap...@grupobbv.net> wrote in message
news:OCm$qWNKBHA.1268@tkmsftngp05...

Kirill Lapin

unread,
Aug 19, 2001, 6:30:36 PM8/19/01
to
Tom/Harrald,

What is SendKeys, please?

Many thanks,
Kirill

"Tom Ogilvy" <twog...@email.msn.com> wrote in message
news:e6xUxJOKBHA.1904@tkmsftngp04...

Jeff McAhren

unread,
Aug 19, 2001, 7:08:03 PM8/19/01
to
Hi Kirill,

Look up SendKeys in VBA help. Basically, Sendkeys emulates keyboard key
presses.

--
Jeff McAhren
Dallas, Texas


"Kirill Lapin" <lap...@grupobbv.net> wrote in message

news:#BvvH1PKBHA.1728@tkmsftngp02...

Dave Peterson

unread,
Aug 19, 2001, 7:12:03 PM8/19/01
to
It's like typing at the keyboard.

The bad news is: You better be sure that you're at the correct program and at
the correct screen with the correct options displayed--otherwise,....

If you send it the correct combination of keys and never touch the
keyboard/mouse while it's executing, you might get lucky.

Bill Manville posted something awhile ago. Look here (on google):

http://groups.google.com/groups?hl=en&newwindow=1&safe=off&th=a6494b113d43b67e,2&seekm=VA.00000548.04f327a3%40msn.com#p

--

Dave Peterson
ec3...@msn.com

Harald Staff

unread,
Aug 20, 2001, 4:07:18 AM8/20/01
to
Kirill

As others stated, it's imitating keyboard keypresses.

Here's a macro from my code library. Unfortunately I did not save the
author's name, but it's from one of this group's frequent and brilliant
posters:

Sub deprotect()
Application.SendKeys "%{F11}", True 'opens vbeditor
Application.SendKeys "^r", True 'project window
Application.SendKeys "{DOWN}", True 'down arrow somehow
'makes the password dialog come up.
Application.SendKeys "2", True 'enters the password, here it's 2
Application.SendKeys "{ENTER}", True 'enters the password
'Application.SendKeys "{F5}", True 'run macro
'Application.SendKeys "fixup~", True 'fixup is the name of the
macro
'that doesn't work unless the project is unprotected.
End Sub

Best wishes Harald


Kirill Lapin <lap...@grupobbv.net> skrev i
news:#BvvH1PKBHA.1728@tkmsftngp02...

Kirill Lapin

unread,
Aug 20, 2001, 5:52:09 PM8/20/01
to
Harald,

Thanks a lot for the code. Looks like it only affects the VBAProject in
which the macro is stored. The good thing is that you do not need to protect
the file again when finished working with the project.

Kirill.


"Harald Staff" <harald...@nrk.no> wrote in message
news:emK0j8UKBHA.700@tkmsftngp04...

0 new messages