Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Ok.
Ray Clark wrote: Dave, I appreciate all your help but may have found a way around this problem. Ray "Dave Peterson" wrote: What happened when you ran the small version of the macro and then opened the workbook manually? Wasn't the password to open prompt gone? Ray Clark wrote: No Dave did not work Ray "Dave Peterson" wrote: When you tested without the extra code, did it work correctly? Ray Clark wrote: Dave, Tried adding some extra code to remove the password prior to saving the copy but when opening it still has the password. This is the coding I have been using........ Private Sub Back_Up_Button_Click() RQ1 = MsgBox("Save Maintenance Day Roster?", vbYesNo, "SAVE") If RQ1 = vbYes Then ActiveWorkbook.Save With ActiveWorkbook .Password = "" End With RQ2 = MsgBox("Save Copy for Viewing?", vbYesNo, "SAVE COPY") If RQ2 = vbYes Then RQ3 = MsgBox("Copy saved as 'Maint Day Roster for Viewing' and Closed", vbOKOnly, "SAVE CLOSE Copy") SetAttr "N:\MaintCo-ord\Mech\Maint Day Roster for Viewing.xls", vbNormal ActiveWorkbook.SaveCopyAs "N:\MaintCo-ord\Mech\Maint Day Roster for Viewing.xls" Workbooks.Open Filename:="N:\MaintCo-ord\Mech\Maint Day Roster for Viewing.xls", _ UpdateLinks:=0 ActiveSheet.Shapes("Back_Up_Button").Select Selection.Cut ActiveWorkbook.Save ActiveWorkbook.Close SetAttr "N:\MaintCo-ord\Mech\Maint Day Roster for Viewing.xls", vbReadOnly ElseIf RQ2 = vbNo Then RQ2A = MsgBox("Close Maint Day Roster?", vbYesNo, "CLOSE") If RQ2A = vbYes Then ActiveWorkbook.Close End If End If RQ4 = MsgBox("CLOSE File?", vbYesNo, "CLOSE FILE") If RQ4 = vbYes Then ActiveWorkbook.Close End If ElseIf RQ1 = vbNo Then RQ1A = MsgBox("Close File No Save", vbYesNo, "CLOSE FILE DON'T SAVE") If RQ1A = vbYes Then ActiveWorkbook.Close End If End If End Sub Any suggestions. Thanks Ray "Dave Peterson" wrote: If you don't care about losing the original workbook's password or know the password to reapply it, you can use code like: Option Explicit Sub testme() Dim CurWkbk As Workbook Dim myFileName As String Dim PWD As String myFileName = "C:\book2222.xls" PWD = "a" Set CurWkbk = ActiveWorkbook With CurWkbk 'remove the password to open .Password = "" 'do the savecopyas .SaveCopyAs Filename:=myFileName 'reapply the password .Password = PWD End With End Sub Ray Clark wrote: I have an Excel workbook which requires a password to open. I need to savecopyas but when opening the copy (which is read only) not require a password. -- Dave Peterson -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
password on a tab | Excel Discussion (Misc queries) | |||
SaveCopyAs with a twist | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. | Excel Worksheet Functions | |||
bypass password when update linking of password protected file | Excel Discussion (Misc queries) |