Thread: Import module
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Import module

hi,

Sub TestUnprotectVBA()
'the password = "a"
Workbooks.Open Filename:="C:\temp\MyFile.xls"
Call UnprotectVBProject(ActiveWorkbook, "a")
End Sub

Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
Dim vbProj As Object
Set vbProj = WB.VBProject
If vbProj.Protection < 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
SendKeys Password & "~~"
Application.VBE.CommandBars(1).FindControl(ID:=257 8, _
recursive:=True).Execute
End Sub


--
isabelle