Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,my friends,
My Problem is -- There're a batch of workbooks with the same konwn vba project password.how to clear them at one time? The following procedure can not work. Sub UnprtVBA() Dim filename As Variant Dim PassWd As Variant Dim thisbook As Workbook Application.DisplayAlerts = False Application.ScreenUpdating = False filename = Application.GetOpenFilename("Excel Files (*.xls), *.xls", , "MultiSelect", MultiSelect:=True) If VarType(filename) = vbBoolean Then Exit Sub PassWd = Application.InputBox("If you the WorkBooks are proteced by a password, enter it below" & Chr(13) & Chr(13) & "Leave the field blank if no password is required", AT) If PassWd = False Then Exit Sub For i = 1 To UBound(filename) Set thisbook = Workbooks.Open(filename(i)) Dim vbProj As Object Set vbProj = thisbook.VBProject If vbProj.Protection = 1 Then Application.SendKeys "%{F11}", True Application.SendKeys "%T", True Application.SendKeys "e", True myPW = PassWd Application.SendKeys myPW, True Application.SendKeys "{ENTER}", True Application.SendKeys "{ENTER}", True Application.SendKeys "%{F11}", True End If Application.SendKeys "%{F11}", True Application.SendKeys "%T", True Application.SendKeys "e", True myPW = PassWd Application.SendKeys "^{TAB}", True Application.SendKeys "{-}", True Application.SendKeys "{TAB}", True Application.SendKeys "{DEL}", True Application.SendKeys "{TAB}", True Application.SendKeys "{DEL}", True Application.SendKeys "{ENTER}", True Application.SendKeys "%{F11}", True thisbook.Save thisbook.Close True Next Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Transfer a name from one cell to another but leave clear if clear? | Excel Worksheet Functions | |||
run batch job from each row - how to insert run batch function per row? | Excel Discussion (Misc queries) | |||
clear the clear the web page email attachment lines | Excel Discussion (Misc queries) | |||
help with projects | Excel Discussion (Misc queries) | |||
How to become a better programmer, post college. More projects or less projects. | Excel Programming |