+ Reply to Thread
Results 1 to 2 of 2

Sendkeys Unlocks VBA Project but Still Pops Up Password Prompt

  1. #1
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Sendkeys Unlocks VBA Project but Still Pops Up Password Prompt

    * * * * I've made new discoveries but am not able to delete this original post. My question has therefore changed a little bit. Please ignore this post and read the first reply. Thanks! * * * *



    The symptom: It keeps prompting for VBA Project Password even though I have supplied the correct password via Sendkeys.

    After a lot of research on possibility of getting the VBA projects unlocked programmatically, I had to resort to SendKeys as a short-term/time-sensitive solution. I found some sample code online and have gotten it to work once, but it has stopped working since my 2nd test. I cannot figured out how I did differently the first time.

    Given that I did not touch the keyboard or mouse after the procedure starts running, I was wondering if any part of the parent procedure calls that require user action could have messed up the Sendkeys. The User will click a command button on a Worksheet to browse and select an older version workbook to update. The entire process include some worksheet changes and eventually get to the part of unlocking and updating of VBA project on the old file. Could the Action of browsing/selecting the target file mess up the SendKeys value? Or is it the SendKeys not coded properly? I greatly appreciate if anybody can offer some pointers. Thanks!


    Please Login or Register  to view this content.
    Last edited by m3atball; 01-31-2011 at 08:16 PM. Reason: New discovery and change to question

  2. #2
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Sendkeys Unlocks VBA Project but Still Pops Up Password Prompt

    I'm rephasing my question as I have made some progress since my last post.

    I've been having trouble with sending passwords using Sendkeys to unlock the VBA Project in a destination file to update its codes and modules. It is used for the purpose of autoamtically updating custom workbook functionalities for many users periodically.

    Problematic Behavior: Even though I have supplied the correct password, the "Password Automation" and the subsequent "Project Properties" windows will still pop up. The twist is that if I simply ESC out of both pop-ups and the program will actually continue successfully unlocking the VBA project. However, when the "Project Properties" pop up is displayed, a curious user can actually use the Protection tab to remove the password for the VBA project.

    I'm struggling to see if there is a way to automacially escaping out of those two popups so the user will not have the chance to disable VBA project protection - either not allowing the two windows to pop up, or automatcially ESC out of them when they show up.

    Below is the code I used based on some sample code out on the web. Your help is greatly appreciated!

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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