How to save ImageMSO icon from Microsoft Office 2007?

前端 未结 4 2098
面向向阳花
面向向阳花 2021-02-06 01:58

I found a lot of nice icons from Microsoft Office 2007. Do you any idea for extract & save all icons as PNG files by using VBA?

Partial ImageMSO http://rabu4g.bay.li

4条回答
  •  野的像风
    2021-02-06 02:24

    I have tried Ismail's answer and it did work great. However it took me a while to figure out how to make it work. I may share this bit of knowledge:

    The solution requires ExcelDna from codeplex: link.

    As I am using Net 4.0 I do not have .zip support so I first extracted the .xslm files to a flat directory structure then I changed the code to read directly from the files. Then in the Excel I call the ExcelDna extension method as

    =ExtractIcons("Office2207IconsGallery";"folder_where_to_store_icons")
    

    The using statements for the utility class (for me):

    using System.Xml.Linq;
    
    using System.IO;
    
    using System.Drawing;
    
    using System.Runtime.InteropServices;
    
    using System.Drawing.Imaging;
    
    using Application = Microsoft.Office.Interop.Excel.Application;
    
    using ExcelDna.Integration;
    
    using stdole;
    

    Hope this helps.... Thank you Ismail!

提交回复
热议问题