+ Reply to Thread
Results 1 to 3 of 3

Opening Password-protected workbook, but still being prompted for password

  1. #1
    Registered User
    Join Date
    01-01-2015
    Location
    Mississippi, United States
    MS-Off Ver
    2010
    Posts
    2

    Opening Password-protected workbook, but still being prompted for password

    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

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,368

    Re: Opening Password-protected workbook, but still being prompted for password

    Welcome to the forum. Please take a few moments to read the forum rules and add Code Tags to your code excerpts. Thanks.

    It's not just "equals", it's "colon equals"

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-01-2015
    Location
    Mississippi, United States
    MS-Off Ver
    2010
    Posts
    2

    Re: Opening Password-protected workbook, but still being prompted for password

    You rock. Thank you very much. I had assumed the code was correct as it wasn't indicating an error, but I should've looked a little bit closer at the examples! (Rookie here)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  2. Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  3. Replies: 0
    Last Post: 09-06-2005, 06:05 AM
  4. Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. Replies: 0
    Last Post: 09-05-2005, 10:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1