Hello! I seem to have hit a brick wall. I'm trying to open a workbook which has a password that was set using the "Save As", tools -> General Options method. That password is the only one set for this workbook, and it is "roster". When I run this macro, it works for doing what it is intended, with the exception that is still prompts for the "roster" password. I'd tried the "writerespassword" with no success, as well as unprotecting the workbook in question, as well as the worksheets. I isolated the Set wb = Workbooks.Open(ActiveWorkbook.Path line, removing any of the lines of code that altered the other workbook, still getting the password prompt. My last ditch effort of using "SendKeys" to do my password bidding failed when I realized SendKeys doesn't work on the password prompt (used application.wait to see if it was a matter of waiting for the processes to complete before sending the keys - failed!).

Any help would be greatly appreciated! As an afterthought, I would also like not to receive a dialogue box that pops up from the secondary workbook with the privacy act statement. I want to forgo that dialogue box, so that it appears that everything just runs in the background when this macro is run. Thank you very much for taking the time to read this rather lengthy post. Happy new year! -Dan

Dim wb As Excel.Workbook
Set wb = Workbooks.Open(ActiveWorkbook.Path & "\" & UserForm1.classno & ".xlsm", Password = "roster")


Here is the code for the entire subroutine, if that helps:

'Export Student
Private Sub CommandButton1_Click()
thisworkbook.Unprotect
UserForm1.Hide

Dim wb As Excel.Workbook
Set wb = Workbooks.Open(ActiveWorkbook.Path & "\" & UserForm1.classno & ".xlsm", Password = "roster")

thisworkbook.DisplayDrawingObjects = xlDisplayShapes
wb.Sheets("BLOCK 1").Range("B15").Value = UserForm1.StudID

wb.Save
wb.Close

UserForm1.StudID.Value = ""
UserForm1.classno.Value = ""
thisworkbook.Protect
End Sub