B
BEETAL
here is a programme I found on net. I want to modify this programme so that
the project itself becomes unviewable. I can bet that I had one code before
which I have misplaced . That four to five liner use to just shut down the
project.
here sis the code found from net. It is not mine. I am not capable of such
sophisticated coding as of now. Thank you
Option Explicit
Const BreakIt As String = "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}"
Sub Change_VBA_PW()
Dim WB As Workbook
Dim Password As String
Set WB = ActiveWorkbook
Password = "test"
Call SetVBProjectPassword(WB, Password)
End Sub
Sub SetVBProjectPassword(WB As Workbook, ByVal Password As String)
'Needs reference to Visual Basic for Applications Extensibility Library
Dim VBP As VBProject, openWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer
Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook
Application.ScreenUpdating = False
' close any code windows to ensure we hit the right project
For Each openWin In VBP.VBE.Windows
If InStr(openWin.Caption, "(") > 0 Then openWin.Close
Next oWin
WB.Activate
Application.OnKey "%{F11}"
SendKeys BreakIt & Password & "{tab}" & Password & "~%{F11}", True
Application.ScreenUpdating = True
wbActive.Activate
End Sub
The idea is to make this programme close all the modules and "do not ask for
a password"
Please help .
Thank you very much.
the project itself becomes unviewable. I can bet that I had one code before
which I have misplaced . That four to five liner use to just shut down the
project.
here sis the code found from net. It is not mine. I am not capable of such
sophisticated coding as of now. Thank you
Option Explicit
Const BreakIt As String = "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}"
Sub Change_VBA_PW()
Dim WB As Workbook
Dim Password As String
Set WB = ActiveWorkbook
Password = "test"
Call SetVBProjectPassword(WB, Password)
End Sub
Sub SetVBProjectPassword(WB As Workbook, ByVal Password As String)
'Needs reference to Visual Basic for Applications Extensibility Library
Dim VBP As VBProject, openWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer
Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook
Application.ScreenUpdating = False
' close any code windows to ensure we hit the right project
For Each openWin In VBP.VBE.Windows
If InStr(openWin.Caption, "(") > 0 Then openWin.Close
Next oWin
WB.Activate
Application.OnKey "%{F11}"
SendKeys BreakIt & Password & "{tab}" & Password & "~%{F11}", True
Application.ScreenUpdating = True
wbActive.Activate
End Sub
The idea is to make this programme close all the modules and "do not ask for
a password"
Please help .
Thank you very much.