+ Reply to Thread
Results 1 to 4 of 4

Error on password unprotect macro upon workbook open event

  1. #1
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Dallas, Texas
    MS-Off Ver
    O365 with latest Excel
    Posts
    107

    Error on password unprotect macro upon workbook open event

    Greetings All!

    I have a large workbook with a data connection that feeds into a pivot table on a separate sheet. When the data connection updates, the pivot table wasn't. So I looked around and found the magical RefreshAll vba. However, all of the sheets are locked so users can't muck up the pivot table. So I tried adding in the code to unprotect the worksheet with the pivot table, then having the refresh run, and then finally reprotecting the sheet upon the workbook opening.

    The problem is that it says my password is not correct when I try to run the macro...but excel takes the password just fine if I unprotect it manually.

    I have the code for the refresh itself inside a module:
    Please Login or Register  to view this content.
    and the vba to run it upon opening in the This Workbook area:
    Please Login or Register  to view this content.
    I also have set the data connections to not update unless I refresh them.

    Since the file is large - nearly 6 Mb, could that be a problem? Even before the macro issues, the data connection itself was taking around 20 seconds to complete.
    I am also working on them from home, so I am using a mac here but a pc there...could that be a problem?
    The data connection itself is to an internal website that requires logging in...but the error comes from the password unprotect line of code.

    Any ideas would be greatly appreciated!
    Last edited by phpolicylady; 12-13-2015 at 01:49 PM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error on password unprotect macro upon workbook open event

    I believe the syntax might be incorrect. Try
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    05-16-2013
    Location
    Dallas, Texas
    MS-Off Ver
    O365 with latest Excel
    Posts
    107

    Re: Error on password unprotect macro upon workbook open event

    I think you must be right - darn those tiny little issues!

    Thanks bunches!

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error on password unprotect macro upon workbook open event

    No problem, glad I could help.

+ 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. Macro to unprotect and protect a workbook - error 32809
    By erlend9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 03:20 AM
  2. Replies: 0
    Last Post: 03-12-2013, 02:33 AM
  3. [SOLVED] Password & cell splash error when open workbook
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2012, 12:39 PM
  4. How to unprotect a workbook if the password is lost
    By CantripGhost in forum Excel General
    Replies: 2
    Last Post: 12-21-2010, 09:50 AM
  5. how can we create a macro that run only once on open workbook event
    By sharmanjali87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-10-2010, 02:00 AM
  6. how can we create a macro that run only once on open workbook event
    By sharmanjali87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2010, 01:55 AM
  7. [SOLVED] Record a macro which enters a password to unprotect a workbook
    By Zeon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 03:25 PM
  8. [SOLVED] Unprotect workbook without password
    By Maria K Brickl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2005, 02:05 PM

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