Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there any way to Protect/Unprotect the VBAProject from within the VB code
rather than from the VisualBasic user interface? thanks, ken |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Only using sendkeys.
-- Regards, Tom Ogilvy "Ken Soenen" wrote in message ... Is there any way to Protect/Unprotect the VBAProject from within the VB code rather than from the VisualBasic user interface? thanks, ken |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can keep the VB code from ever getting into the users workbook.
How's that? 1. Store the VB code in an AddIn, 2. In the template or workbook, the one having the numbers add subs like these to remove the addin reference : Private Function ReferenceExists(reference As String) As Boolean Dim result As Boolean result = False On Error Resume Next result = Not Me.VBProject.References(reference) Is Nothing ReferenceExists = result End Function Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If ReferenceExists("MyExcellAddin") Then WorkbookUtils.RemoveReferences Me End If End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This might help too.
Private Sub Workbook_Open() If ReferenceExists("MyExcellAddin") Then ' We need to generate the report ReportUtils.AutoGenerateReport Me End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can protect worksheet then workbook but not Protect and Share in code | Excel Programming | |||
Generic protect/unprotect code through buttons and code? | Excel Programming | |||
Activate code from another VBAProject | Excel Programming | |||
VBAProject Protect | Excel Programming | |||
code in VBAProject will not run | Excel Programming |