Je ne pense pas que cela soit possible mais si je ne pose pas la question,
je ne pourrais jamais en etre sur !
J'ai un programme sous VBA Excel dont le code est protégé par un mot de passe.
Dans ce programme, il y a des fonctions utilisable uniquement par l'Admin et
j'aimerais savoir si on pouvais inclure le dévérouillage du code VB à
l'affichage dans le mode Admin afin de pouvoir déboguer le programme plutot
que de cliquer sur "fin" lors d'un plantage (eventuel car je suis tres doué
en vb ! lol)
'=============== Sub TestProtect() ProtectVBProject Workbooks("Perso.xls"), "zaza" End Sub
Sub TestUnprotect() UnprotectVBProject Workbooks("Perso.xls"), "zaza" 'pour qu'Excel reconnaisse la nouvelle situation (déprotection) DoEvents With Workbooks("Perso.xls") 'ajout d'un module standard .VBProject.VBComponents.Add 1 End With End Sub
Sub UnprotectVBProject(WB As Workbook, ByVal Password As String) Dim vbProj As Object
Set vbProj = WB.VBProject
'can't do it if already unlocked! If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
' now use lovely SendKeys to quote the project password SendKeys Password & "~~" Application.VBE.CommandBars(1).FindControl(ID:%78, recursive:=True).Execute End Sub
Sub ProtectVBProject(WB As Workbook, ByVal Password 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 password SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & _ Password & "~"
Je ne pense pas que cela soit possible mais si je ne pose pas la question, je ne pourrais jamais en etre sur ! J'ai un programme sous VBA Excel dont le code est protégé par un mot de passe.
Dans ce programme, il y a des fonctions utilisable uniquement par l'Admin et j'aimerais savoir si on pouvais inclure le dévérouillage du code VB à l'affichage dans le mode Admin afin de pouvoir déboguer le programme plutot que de cliquer sur "fin" lors d'un plantage (eventuel car je suis tres doué en vb ! lol)
'=============== Sub TestProtect()
ProtectVBProject Workbooks("Perso.xls"), "zaza"
End Sub
Sub TestUnprotect()
UnprotectVBProject Workbooks("Perso.xls"), "zaza"
'pour qu'Excel reconnaisse la nouvelle situation (déprotection)
DoEvents
With Workbooks("Perso.xls")
'ajout d'un module standard
.VBProject.VBComponents.Add 1
End With
End Sub
Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
Dim vbProj As Object
Set vbProj = WB.VBProject
'can't do it if already unlocked!
If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
' now use lovely SendKeys to quote the project password
SendKeys Password & "~~"
Application.VBE.CommandBars(1).FindControl(ID:%78,
recursive:=True).Execute
End Sub
Sub ProtectVBProject(WB As Workbook, ByVal Password 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 password
SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & _
Password & "~"
Je ne pense pas que cela soit possible mais si je ne pose pas la question,
je ne pourrais jamais en etre sur !
J'ai un programme sous VBA Excel dont le code est protégé par un mot de passe.
Dans ce programme, il y a des fonctions utilisable uniquement par l'Admin et
j'aimerais savoir si on pouvais inclure le dévérouillage du code VB à
l'affichage dans le mode Admin afin de pouvoir déboguer le programme plutot
que de cliquer sur "fin" lors d'un plantage (eventuel car je suis tres doué
en vb ! lol)
'=============== Sub TestProtect() ProtectVBProject Workbooks("Perso.xls"), "zaza" End Sub
Sub TestUnprotect() UnprotectVBProject Workbooks("Perso.xls"), "zaza" 'pour qu'Excel reconnaisse la nouvelle situation (déprotection) DoEvents With Workbooks("Perso.xls") 'ajout d'un module standard .VBProject.VBComponents.Add 1 End With End Sub
Sub UnprotectVBProject(WB As Workbook, ByVal Password As String) Dim vbProj As Object
Set vbProj = WB.VBProject
'can't do it if already unlocked! If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
' now use lovely SendKeys to quote the project password SendKeys Password & "~~" Application.VBE.CommandBars(1).FindControl(ID:%78, recursive:=True).Execute End Sub
Sub ProtectVBProject(WB As Workbook, ByVal Password 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 password SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & _ Password & "~"
Je ne pense pas que cela soit possible mais si je ne pose pas la question, je ne pourrais jamais en etre sur ! J'ai un programme sous VBA Excel dont le code est protégé par un mot de passe.
Dans ce programme, il y a des fonctions utilisable uniquement par l'Admin et j'aimerais savoir si on pouvais inclure le dévérouillage du code VB à l'affichage dans le mode Admin afin de pouvoir déboguer le programme plutot que de cliquer sur "fin" lors d'un plantage (eventuel car je suis tres doué en vb ! lol)