Here is a method to save an Excel selection (either a range object OR an actual object eg Image) using the API CopyEnhMetaFileA from the gdi32.dll.
In this page I use the export method of a chart object to save an image THEN import it into what ever application I need.
The steps required are in the above page;
1) Copy (Selection or image)
2) create chart
3) Paste to chart
4) Export chart image
5) load it or reference it in the application I need it for.
This API method just requires 1) , 4) and 5)
It is quicker and cleaner IMHO .................
When using API's of this ilk i.e create, open etc it is IMPORTANT that you use it's corresponding "Release" API to release resources to it. This is no different when using this API, since Windows keeps a record of GDI objects on a per-process basis, only the application that created the GDI object is able to use the corresponding GDI functions with it or remove it from the system eg delete it.
The API we need to ALWAYS USE for this is DeleteEnhMetaFile (Note: this API does NOT actually delete the newly created EMF file, it just releases resources to it.
Remember anything that your program has to acquire you should release, you are probably doing this now BUT it cannot be over stated when using APIs.
As a rule of thumb;
Even if the documentation states that Windows takes care of releasing the resource used by a process when it exits, USE the corresponding Delete/Destroy/Release API.
Examples (But by no means all)
LoadBitmapA > DeleteObject
CreateBitmap > DeleteObject
CreateSolidBrush > DeleteObject
CreateCursor > DestroyCursor
CreateCompatibleDC > DeleteDC
GetDC > ReleaseDC
CreateFontA > DeleteObject
CreateIcon > DestroyIcon
ExtractIconA > DestroyIcon
CreateMetaFileA > CloseMetaFile
CopyMetaFileA > DeleteMetaFile
What is an EMF File - Microsoft office applications actually use this format and saves it to your Temp directory, you will see this as "mso1E5.emf" so you know you can use these in Microsoft products.
Reference from:
EMF - Enhanced Metafile
The Enhanced Metafile format is a 32-bit format that can contain both vector and bitmap information. It is an improvement over the Windows Metafile Format and contains extended features such as:
Built-in scaling information.
Built-in descriptions that are saved with the file.
Improvements in color palettes and device independence.
The EMF format is an extensible format, which means that a programmer can modify the original specification to add functionality or meet specific needs. This can lead to incompatibilities between different types of EMF pictures.
Advantages;
Extensible file format
Improved features compared to WMF
Disadvantages;
Extensibility results in many different types of EMF pictures. Not all EMF files are compatible with all programs that support the EMF standard
DOWNLOAD: