Thread: Import module
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Charlotte E[_2_] Charlotte E[_2_] is offline
external usenet poster
 
Posts: 38
Default Import module

Thanks - I'll look at it tonight when I back :-)

CE


"isabelle" wrote in message ...
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