Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How to Unprotect Project Protection through Macro

Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How to Unprotect Project Protection through Macro

Project protection (set within the VBE environment) is not full proof, but
should not prevent macros running! Are you protecting the sheets /
workbook? As in this case macros may not work if they need access to the
sheets within the workbook.

You cannot unprotect projects using VBA, but you can unprotect sheets /
workbooks at the start of your code and then protect them again at the end.
Is this your problem?

--
Cheers
Nigel



"Resant" wrote in message
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default How to Unprotect Project Protection through Macro

Hi resant

There's no VB object for this. It is possible, but vulnerable, to use
SendKeys and simulate the manual action. See
http://tinyurl.com/926n9

HTH. best wishes Harald

"Resant" skrev i melding
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How to Unprotect Project Protection through Macro

The SendKeys to UnProtect Macro is work, but cannot Protect the Macro
again except we must close Excel.
When Protect Macro executing, VB Project Properties window show
flashly.
But the macro unable to protect?

What's wrong?

Thanks,

Resant


Harald Staff wrote:
Hi resant

There's no VB object for this. It is possible, but vulnerable, to use
SendKeys and simulate the manual action. See
http://tinyurl.com/926n9

HTH. best wishes Harald

"Resant" skrev i melding
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How to Unprotect Project Protection through Macro

Please help me,

Why I cannot protect the Macro again?
Actually even when we protect the Macro manually by click Tools, etc.
It won't abel to protect the Macro, except restart excel first, rite?

Below is the code that I took from forum :

Sub ProtectVBProject(WB As Workbook, ByVal strPassword As String)
Dim vbProj As Object

Set vbProj = WB.VBProject

'can't do it if already locked!
If vbProj.Protection = 1 Then Exit Sub

Set Application.VBE.ActiveVBProject = vbProj

' now use lovely SendKeys to set the project strPassword
SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & strPassword & "{TAB}" &
strPassword & "~"

'Application.VBE.CommandBars(1).FindControl(ID:=25 78,
recursive:=True).Execute

'WB.Save

End Sub


Thanks again


Resant wrote:
The SendKeys to UnProtect Macro is work, but cannot Protect the Macro
again except we must close Excel.
When Protect Macro executing, VB Project Properties window show
flashly.
But the macro unable to protect?

What's wrong?

Thanks,

Resant


Harald Staff wrote:
Hi resant

There's no VB object for this. It is possible, but vulnerable, to use
SendKeys and simulate the manual action. See
http://tinyurl.com/926n9

HTH. best wishes Harald

"Resant" skrev i melding
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to Unprotect Project Protection through Macro

The workbook has to be closed and reopened to make the project unviewable.

And you don't have to reprotect the project. If you don't remove the protection
(different than just unlocking the project), then the project will be protected
when you reopen it next time.



Resant wrote:

Please help me,

Why I cannot protect the Macro again?
Actually even when we protect the Macro manually by click Tools, etc.
It won't abel to protect the Macro, except restart excel first, rite?

Below is the code that I took from forum :

Sub ProtectVBProject(WB As Workbook, ByVal strPassword As String)
Dim vbProj As Object

Set vbProj = WB.VBProject

'can't do it if already locked!
If vbProj.Protection = 1 Then Exit Sub

Set Application.VBE.ActiveVBProject = vbProj

' now use lovely SendKeys to set the project strPassword
SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & strPassword & "{TAB}" &
strPassword & "~"

'Application.VBE.CommandBars(1).FindControl(ID:=25 78,
recursive:=True).Execute

'WB.Save

End Sub

Thanks again

Resant wrote:
The SendKeys to UnProtect Macro is work, but cannot Protect the Macro
again except we must close Excel.
When Protect Macro executing, VB Project Properties window show
flashly.
But the macro unable to protect?

What's wrong?

Thanks,

Resant


Harald Staff wrote:
Hi resant

There's no VB object for this. It is possible, but vulnerable, to use
SendKeys and simulate the manual action. See
http://tinyurl.com/926n9

HTH. best wishes Harald

"Resant" skrev i melding
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How to Unprotect Project Protection through Macro

Thanks for your respon
But what you mean by Remove the protection different form Unlock the
Project?
Could you explain it?

Thank you very much

Dave Peterson wrote:
The workbook has to be closed and reopened to make the project unviewable.

And you don't have to reprotect the project. If you don't remove the protection
(different than just unlocking the project), then the project will be protected
when you reopen it next time.



Resant wrote:

Please help me,

Why I cannot protect the Macro again?
Actually even when we protect the Macro manually by click Tools, etc.
It won't abel to protect the Macro, except restart excel first, rite?

Below is the code that I took from forum :

Sub ProtectVBProject(WB As Workbook, ByVal strPassword As String)
Dim vbProj As Object

Set vbProj = WB.VBProject

'can't do it if already locked!
If vbProj.Protection = 1 Then Exit Sub

Set Application.VBE.ActiveVBProject = vbProj

' now use lovely SendKeys to set the project strPassword
SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & strPassword & "{TAB}" &
strPassword & "~"

'Application.VBE.CommandBars(1).FindControl(ID:=25 78,
recursive:=True).Execute

'WB.Save

End Sub

Thanks again

Resant wrote:
The SendKeys to UnProtect Macro is work, but cannot Protect the Macro
again except we must close Excel.
When Protect Macro executing, VB Project Properties window show
flashly.
But the macro unable to protect?

What's wrong?

Thanks,

Resant


Harald Staff wrote:
Hi resant

There's no VB object for this. It is possible, but vulnerable, to use
SendKeys and simulate the manual action. See
http://tinyurl.com/926n9

HTH. best wishes Harald

"Resant" skrev i melding
ups.com...
Hi All,
I've big problem.
I've to modify macro code using VBE, and it's done succesfully.
But it won't work if I protect the macro with a password. But I have to
do that to prevent user change the code.
Could I unprotect the Project's Protection through the Macro?

Please help me, I really need this

Thanks,

Resant


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
protect / unprotect VBA project by macro sylvain Excel Discussion (Misc queries) 0 July 31st 06 06:09 PM
Can project unprotect self? [email protected] Excel Programming 1 May 3rd 06 08:51 AM
protect/unprotect a VBA Project mangesh_yadav[_213_] Excel Programming 6 May 27th 05 01:30 AM
protect/unprotect a VBA Project helmekki[_57_] Excel Programming 0 May 25th 05 12:56 PM
Protect\Unprotect VBA project Rohit Thomas Excel Programming 2 August 28th 03 04:16 PM


All times are GMT +1. The time now is 07:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"