+ Reply to Thread
Results 1 to 7 of 7

VBA to refresh vlookup values from password protected workbook

  1. #1
    Registered User
    Join Date
    01-19-2016
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    5

    VBA to refresh vlookup values from password protected workbook

    Hi,

    I currently have a master workbook that is password protected and only accessible to a few people, and a general workbook that has a lot of vlookups into the master to retrieve and present data that is open to everyone.

    When I open the general document I'm prompted to update links and clicking Yes returns an error that the links can't update. What I have to do to update the general document is;

    1. Open it, choose to not update the links
    2. Go to Data > Edit Links > Open Source
    3. Open the master document as read only
    4. Close the master document without saving changes
    5. Click Check Status in the general document
    6. Wait for OK to be returned in the status field

    The functionality I would like is;

    1. Open the general document and not be prompted with the standard Excel ‘update links’ dialogue box
    2. Have a button for users to click that will open the master document in read-only mode in the background so it’s not visible to users
    3. Automatically input the password, update the connection status or similar to refresh the vlookup values
    4. Close the master document without saving changes

    Would it be possible to build this functionality in Excel VBA then attach to a button?

    Thanks in advance!
    Adam

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: VBA to refresh vlookup values from password protected workbook

    You can do better than a button, you can add code to the workbook open event to do this automatically when a user opens the workbook.

    And what you actually want there can be recorded with the macro recorder and aid your learning rather than have someone else write it all for you. Go do that, post the resulting code it'll write for in here and we'll have a looksee, clean it up and make it all happen in the background invisibly to the user for you.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA to refresh vlookup values from password protected workbook

    To stop the 'update links' warning, see this link https://www.extendoffice.com/documen...ks-prompt.html

    Completely untested code cobbled together over brunch, I don't have any password protected files with links on my laptop to test theory.
    You will need to edit the parts in bold text.
    Please Login or Register  to view this content.
    @bellygas, I could be wrong, but I don't think that the macro recorder will detect opening things like opening a workbook.
    Last edited by jason.b75; 04-11-2019 at 07:50 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: VBA to refresh vlookup values from password protected workbook

    AAAAAAAARRRRRRRGH. Another one I try to persuade to try learning something who isn't going to now...

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA to refresh vlookup values from password protected workbook

    No point it trying to teach a runner how to walk

  6. #6
    Registered User
    Join Date
    01-19-2016
    Location
    West Midlands, England
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA to refresh vlookup values from password protected workbook

    Thanks very much guys, the code for an update button works a treat!

    I've tried a couple of different things within the workbook open event and I'm still getting the message pop-up... things I've tried are:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I've also disabled hints from the Data > Edit Links option box. One anomoly is when looking in File > Options > Advanced > General > Ask to update automatic links.... I've tried un-checking this option then saving the workbook but the next time it opens the update links box reappears.

    Not sure if this is related or not, nor how to force that checkbox to remain empty..?

    Thanks
    Ada

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA to refresh vlookup values from password protected workbook

    I think that in the link I provided, you will need to use the middle option at step 3, 'Don’t display the alert and don’t update automatic links'.

    Check the box in excel options first, if I've read it correctly, unchecking it is probably overriding, or conflicting with the setting on the workbook.

    Trying it with vba won't work if it's in the same workbook, it would need to be in a different workbook and in code that is going to open the workbook where you want the warning suppressed.

+ 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: 03-28-2018, 02:49 AM
  2. Replies: 0
    Last Post: 03-28-2018, 02:49 AM
  3. [SOLVED] VBA code to update query from a password protected excel workbook and then close workbook
    By MrChipper in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-14-2017, 07:41 AM
  4. Opening Password-protected workbook, but still being prompted for password
    By dpmcgonigle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2015, 12:34 AM
  5. Replies: 2
    Last Post: 11-17-2014, 04:28 PM
  6. [SOLVED] Password array to open all password protected workbook in a folder
    By rename in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-07-2012, 05:06 AM
  7. Refresh query with a password protected workbook.
    By Joy C in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2011, 12:31 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