LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Adam
 
Posts: n/a
Default Removing Module Protection Programatically

We are trying to push some new code to the our code modules in a workbook.
The issue we face right now is that the modules are protected. Is there a
way to programmatically remove the module protection. So that I can run the
bellow code so that I do not get an error accessing the protected modules.

Sub PatchWorkbook(PatchWBPath As String)
Dim ve As VBE
Dim xl As Excel.Application
Dim wb As Workbook
Dim codeModule As codeModule

Set xl = New Excel.Application
xl.EnableEvents = False
xl.DisplayAlerts = False

Set wb = xl.Workbooks.Open(PatchWBPath, False, False, , "", "", , , , ,
False)
wb.UpdateRemoteReferences = False
xl.Calculation = xlCalculationManual

Set ve = xl.VBE
Debug.Print ve.VBProjects(1).Protection

Set codeModule = ve.ActiveVBProject.VBComponents("ThisWorkbook")

wb.Save
wb.Close
Set wb = Nothing
Set xl = Nothing
End Sub

Thanks in advance!

Reg,
Adam
 
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
Difference in the listing of the New module addition in 2002 version Hari Excel Discussion (Misc queries) 2 January 4th 05 06:56 AM
General protection fault in module HPPCL5F4.DLL at 0002:000006c2. Ben Excel Discussion (Misc queries) 1 January 4th 05 12:05 AM
Access Module coded converted to Excel Function Adam Excel Discussion (Misc queries) 1 December 23rd 04 02:48 PM
EXCELL Protection Mald Excel Discussion (Misc queries) 6 December 22nd 04 09:30 PM
How may I remove Office 2003 DRM protection from DOC & XLS files? Locked out Excel Discussion (Misc queries) 1 December 12th 04 05:22 PM


All times are GMT +1. The time now is 08:20 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"