+ Reply to Thread
Results 1 to 6 of 6

1004: close method of workbook class failed

  1. #1
    Registered User
    Join Date
    04-19-2020
    Location
    Tampa, FL
    MS-Off Ver
    MSO Home and Student 2016
    Posts
    5

    1004: close method of workbook class failed

    I have a set of Excel macros that create powerpoint slides. They were working fine until this month... The issue is when I try to close the chart worksheet after creating a chart.

    This simple procedure reproduces the issue. As I said above, this wasn't an issue a month back. I've created dozen of presentations, so something may have changed with Excel. I'm using MSO Home and Student 2016 (16.0.12624.20422) 32-bit.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: 1004: close method of workbook class failed

    It's probably a conflict of some names.

  3. #3
    Registered User
    Join Date
    04-19-2020
    Location
    Tampa, FL
    MS-Off Ver
    MSO Home and Student 2016
    Posts
    5

    Re: 1004: close method of workbook class failed

    There's no conflict I can detect. And this was working code not long ago. I can't seem to close a chart worksheet via VBA once it's opened by creating a powerpoint chart.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: 1004: close method of workbook class failed

    Hi desmike481,

    Welcome to the forum!!

    If the "myChartData" variable is correctly assigned to an Excel workbook, to close it (without saving) the command is this:

    Please Login or Register  to view this content.
    I'm not sure with your code though as "myChartData" seems to be both PowerPoint and Excel related

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Registered User
    Join Date
    04-19-2020
    Location
    Tampa, FL
    MS-Off Ver
    MSO Home and Student 2016
    Posts
    5

    Re: 1004: close method of workbook class failed

    Apologies I was unclear. I run a set of macros in Excel which create powerpoint presentations with the data from an Excel workbook. The test code I've copied here reproduces the issue I am having. I replaced my close with the one you provided and receive the same error.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: 1004: close method of workbook class failed

    Same issue - this won't work as "myChartData" has been assigned to a PowerPoint object but the following is an Excel only command:

    Please Login or Register  to view this content.
    I'm not sure how it ever worked to be honest

    See how this goes:

    Please Login or Register  to view this content.
    Note also that you cannot "close" an Excel tab so the last line of code closes the entire workbook (though not sure why you'd close it straight after pasting data in without seemingly doing anything else).

    Regards,

    Robert
    Last edited by Trebor76; 04-19-2020 at 08:26 PM.

+ 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. [SOLVED] Selecting a cell in another workbook - 1004: Active method of range class failed
    By Frankie_The_Flyer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2019, 03:11 AM
  2. ERROR 1004: Method Of Range Class Failed.
    By Mathijs.Marketing in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2018, 04:16 AM
  3. Error 1004 Select method from worksheet class failed
    By FrankWade in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-26-2015, 02:03 AM
  4. pastespecial method of range class failed 1004
    By Abbadon486 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-25-2014, 12:08 PM
  5. [SOLVED] error 1004 select method of range class failed
    By Lee_wwfc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-23-2013, 12:34 PM
  6. 1004 Select Method Of Range Class Failed
    By Blewyn in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-02-2007, 08:13 AM
  7. error 1004, method of class/object failed
    By daboyroy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2006, 12:01 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