+ Reply to Thread
Results 1 to 2 of 2

Code fails in one file, works in copy?

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Madison, WI
    MS-Off Ver
    MS Office 2010 (Excel, Word, Access)
    Posts
    72

    Code fails in one file, works in copy?

    I didn't even know that this was possible. I designed a macro (with help from this forum) that looks up billing codes that we match up against a large number of phone numbers used by our employees. It worked on Friday. When we tried using it on Monday, it didn't work, instead throwing a Run Time Error 429: Cannot Create ActiveX Object when I tried to assign "ThisWorkbook" to an object.

    Thinking that there was some sort of update that went through, I started talking to our service desk people, while a fellow co-worker saved the file under a new name to try and tinker with it (we both work with VBA code, I just do so a bit more often.)

    When she tried to run it... it worked. Identical code, no changes beyond the filename, but it worked. So, shrugging my shoulders and thinking I must have just introduced a typo by mistake in the course of working with it, I copied the code in the file that worked, and I pasted it over the matching code in the file that didn't.

    It still doesn't work.

    So I have two pretty-much identical files, running identical code, and one works, but the other doesn't. And I am utterly perplexed at how this is even possible, let alone what happened to make it do this.

    Here's my code in the currently-broken original. Note that this code was originally designed for another file, which is why there are a lot of variables I don't even touch, but it's working despite those most of the time. I'm posting every line and character in the module, rather than trying to "file off the serial numbers." There's nothing proprietary or identifiable in here anyway. It processes through to the line "set wbVM = ThisWorkbook" and then throws the Error 429. Except when it doesn't.

    Please Login or Register  to view this content.
    Here's my code in the version that actually works:

    Please Login or Register  to view this content.
    Why does this work in one file, but not in the other one? Particularly when they're *identical files*? And why would the line "set wbVM = ThisWorkbook" be the line that's causing me to throw the error?
    Last edited by JasonLeisemann; 08-13-2013 at 12:42 PM. Reason: Needed to fix thread title

  2. #2
    Registered User
    Join Date
    11-29-2012
    Location
    Madison, WI
    MS-Off Ver
    MS Office 2010 (Excel, Word, Access)
    Posts
    72

    Re: Code fails in one file, works in copy?

    And, just as mysteriously as the problem started, it's stopped. If I have it again I'll "unsolve" this, if I can, but for the moment... I guess it's solved through the mystery of threatening my machine.

+ 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. Baffled Beginner/Intermediate Excel User
    By michaelaz21 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-28-2013, 08:19 PM
  2. [SOLVED] Excel 2007 : Baffled by the (lack of) result of a countif
    By neil40 in forum Excel General
    Replies: 1
    Last Post: 04-01-2012, 06:43 AM
  3. Strange Vlookup result - baffled
    By andycaps in forum Excel General
    Replies: 9
    Last Post: 01-18-2012, 08:58 AM
  4. Calculation in cell not updating - Totally baffled!
    By bmunoz64 in forum Excel General
    Replies: 1
    Last Post: 01-11-2012, 12:08 PM
  5. thoroughly-baffled by InStr function w/ binary compare
    By terry b in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2005, 01:06 AM

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