+ Reply to Thread
Results 1 to 6 of 6

Cannot delete a custom style imported from another workbook

  1. #1
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Cannot delete a custom style imported from another workbook

    I've been given a workbook that had a tab copied into it from another workbook. The source workbook has evidently evolved over time, accumulating a large number of custom number formats and custom cell styles. (Over 15,000 if thisworkbook.styles.count is to be believed.)

    I ran the below Excel 2007 VBA code to eliminate all but the default styles:
    Please Login or Register  to view this content.
    The new count of cell styles is 68.

    The problem is that 19 custom styles are persistent and cannot be deleted.
    Also, they cannot be selected from the styles dropdown list on the Home tab. Hovering over any of those custom styles makes the dropdown window disappear.

    Examples:
    _5-10-07 Mezz Sales
    _Appendix_Wk 12 Est
    _Appendix_Wk 13 Est Final
    _Target Gaps 2

    The error thrown by the code is:
    Run-time error '1004:
    Delete method of Style class failed


    How can I delete those styles?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626

    Re: Cannot delete a custom style imported from another workbook

    http://support2.microsoft.com/kb/213904 this should be helpful

    Sent from my GT-N7105 using Tapatalk now Free
    I need your support to add reputations if my solution works.


  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Cannot delete a custom style imported from another workbook

    Hi Ron,

    Have you tried the tools listed in #3 here: https://support.microsoft.com/kb/213904
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Cannot delete a custom style imported from another workbook

    Rory/sglife

    Thanks for the suggestion.
    That site, while promising, has the following issues for me:
    1) the link to "2553085 Unused styles are copied from one workbook to another workbook in Excel 2007" goes to a site that throws a runtime error
    "Server Error in '/' Application."

    2) The others link to sites that my company blocks.

    3) When I use my personal computer, I can access the sites (except for the Excel 2007 link). Howver, my work PC permissions don't allow me to download add-ins or access the registry.

    Since the problem exists, I have to assume that my company never installed the fix that prevents unused cell styles from being copied into other workbooks when copying tabs.


    Consequently, I think my only available option is to find VBA code that will kill these annoying cell styles.

    Hoping for something I can use.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Cannot delete a custom style imported from another workbook

    There's a browser based version here: http://sergeig888.wordpress.com/2011...ght-4-version/

    Failing that, you may have to do manual clean up of the XML files.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Cannot delete a custom style imported from another workbook

    Thanks, Rory....Of course, that location is also blocked.
    Looks like XML-editing is in my future.

    I'll mark this thread solved to get it out of the "active" listing.

+ 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. Custom Style Based on Columns
    By powpow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2012, 02:46 PM
  2. Export of a custom table style
    By TomaszTarczynski in forum Excel General
    Replies: 2
    Last Post: 07-01-2011, 02:47 AM
  3. Custom Chart Style
    By rmoney in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-03-2010, 07:02 AM
  4. Is it possible to Create custom fill shading style
    By Webtekr in forum Word Formatting & General
    Replies: 0
    Last Post: 06-01-2009, 01:17 AM
  5. Replies: 0
    Last Post: 08-15-2006, 04:05 PM

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