+ Reply to Thread
Results 1 to 1 of 1

macro to update external data connection

Hybrid View

  1. #1
    Registered User
    Join Date
    10-05-2011
    Location
    Oregon
    MS-Off Ver
    Excel 2007
    Posts
    1

    macro to update external data connection

    Hi,

    This is my first experience with VBA macros so bear with me if my jargon isn't right. I've got a problem with nesting macros involving an external data connection (see attached screencap and code).

    I have a macro to update the data connection to a website and change cell A1 to today's date in static text (Update_website). I have other macros to turn on and off sheet protection on multiple sheets (Sheets_lock and Sheets_unlock) and to perform some tools from the Data tab (Static_month and Static_day). All of these work.

    The problem is my nested macro (Do_everything) that uses all the other ones in unlock-edit-relock sequence. I get the error message telling me that I'm trying to edit a locked sheet. I thought perhaps it was trying to run the update before it finished unlocking the sheets so I experimented with putting in a Wait delay, but that didn't help. After further experimentation with delays in various places, not having it lock at the end, etc I've discovered that no matter what order I code things in the last thing to get done is update the external data. Even in the Update_website macro, the A1 cell gets changed before the website connection is updated even though it's coded to happen afterward.

    As my calculations depend on having current data it's crucial for the Update_website to finish before the other macros start. Am I missing something obvious? Thank you.
    Attached Images Attached Images
    Attached Files Attached Files

+ 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