+ Reply to Thread
Results 1 to 7 of 7

Perplexing error in VBA code

  1. #1
    Registered User
    Join Date
    01-14-2015
    Location
    Tokyo, Japan
    MS-Off Ver
    Office 2007
    Posts
    26

    Perplexing error in VBA code

    I have files I have built to create and email invoices to various teachers. For a couple years, the code to send the sheet to the teachers worked flawlessly (Excel 2003)

    In December, my PC was replaced and updated. Now Excel 2010. The flow of this sheet is such:

    1. I enter data which is totaled and the simple sum is placed on a page called "Invoice"
    2. A macro is run to copy this page and another to a new workbook and place that in a folder.
    3. From that sheet, the button that is on the Invoice is pressed to email the sheet to the teacher. The routine also deletes the send button and saves the file as a macro-free file.

    The button on the original invoice page works fine, and would send the invoice page to the teacher (this is not the step to do that). However, the same button on the actual invoice now creates an error (Run-time error '-2147024809 (80070057)) I am perplexed as the code runs on the original file, and doesn't on the copy of the file.


    Please Login or Register  to view this content.


    The code on the new copy file is the same. This has always worked, and rem out the ActiveSheets shape code and it works properly, without deleting the shape.


    There are 26 files that must be sent this way, and in a month I will need this to work for staff who will cover for me while I am out of the office. Help!
    Last edited by mark1955; 05-15-2018 at 11:26 PM. Reason: Mistake posting

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Perplexing error in VBA code

    That error would indicate that a control with that name ("ControlButton1") was not found. Double check the name of the shape.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    01-14-2015
    Location
    Tokyo, Japan
    MS-Off Ver
    Office 2007
    Posts
    26

    Re: Perplexing error in VBA code

    So, why had it worked for 2-3 years perfectly, and works properly on the original file, but on created file now not work. The name of the control is correct. The code works when pressed on the original page, but on all the copies created after, no longer works, despite the control being exactly the same as previously.

    I do understand the error, but have a problem understanding why the file worked on December 1 in Excel 2007, but not on January 1 in Excel 2010.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Perplexing error in VBA code

    Where do you get the error?

    If it is on the line to delete the button and the button is the only shape on the sheet you could try changing to this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    01-14-2015
    Location
    Tokyo, Japan
    MS-Off Ver
    Office 2007
    Posts
    26

    Re: Perplexing error in VBA code

    Thanks, but no go. Same error.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Perplexing error in VBA code

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

  7. #7
    Registered User
    Join Date
    01-14-2015
    Location
    Tokyo, Japan
    MS-Off Ver
    Office 2007
    Posts
    26

    Re: Perplexing error in VBA code

    I actually found my error. Not sure why or how it had been changed, but it was not in this particular code, but in the code that creates the invoice.
    Please Login or Register  to view this content.
    This little gem for some reason was set to "True," meaning the actual button was protected, not allowing it to be deleted. Thank you all for your time and I appreciate the efforts and I always appreciate the help on this site.

+ 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. Perplexing unknown error on index/match and vlookup...
    By rn0982 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-13-2015, 11:55 AM
  2. [SOLVED] Automatically assign circuit numbers. Perplexing, so ALL GURUS WELCOME.
    By jhren in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 06-09-2015, 12:44 PM
  3. [SOLVED] Perplexing DATE calculations problem
    By Orada in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2013, 07:49 PM
  4. Column Name is Perplexing
    By 2709236 in forum Access Tables & Databases
    Replies: 4
    Last Post: 01-12-2012, 07:20 AM
  5. Perplexing Macro Issue
    By Digger442 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-20-2007, 09:59 AM
  6. Perplexing Excel question
    By Valiantlyon in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-15-2007, 11:15 PM
  7. [SOLVED] Perplexing sheets.
    By ben in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2005, 03:05 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