How can I EXPORT a package object from excel.

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,659
Office Version
  1. 2016
  2. 2003 or older
Platform
  1. Windows
Hi guys,

I imported an ico file as an object as follows.

Code:
    ActiveSheet.OLEObjects.Add(Filename:= _
        "C:\Program Files\Microsoft Office\Office\Forms\POSTL.ICO", link:=False, _
        DisplayAsIcon:=False).Select

I would like to export this package object as an icon file.
Anyone help? :eek:
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
This cannot be done...? Waiting your reply.
 
Upvote 0
Well Colo,

I just faced a similar issue last week, where I needed to import some pictures into a workbook to later export them, and, I thought of your same method... import them as Objects, and export them later using some "Save As" method/verb that I couldn't find...

Luckily for me, I could insert them as pictures, and use Bullen's PastePicture method to save them as bmp... but, in your case, I don't know if that could work... save as bmp, but using an ico extension ?
 
Upvote 0
Juan, thanks for your reply.

Juan Pablo González said:
Well Colo,

I just faced a similar issue last week, where I needed to import some pictures into a workbook to later export them, and, I thought of your same method... import them as Objects, and export them later using some "Save As" method/verb that I couldn't find...

Luckily for me, I could insert them as pictures, and use Bullen's PastePicture method to save them as bmp... but, in your case, I don't know if that could work... save as bmp, but using an ico extension ?

What is Bullen's PastePicture? Export via a chart object?
If so, I'll try your suggestion. After export it as an bitmap file, change extention to ico via name statement.

Regarding to my question, I feel it cannot be done, but at here(MeExcel board), I have seen made impossible thing to possible. So I posted this.

Again, thanks Juan.
 
Upvote 0
Hi Colo

You can do it BUT, for now, the only method i know is to use the Infamous sendkeys in conjunction with OLE Verb construct.

eg..

Code:
    With Application
        .DisplayAlerts = False
        '//
        Selection.Verb Verb:=xlOpen

        .SendKeys "%FS", True
        '// Name the File
        .SendKeys "MyIc.ico", True
        '// Save
        .SendKeys "~", True
        '// Close the object
        .SendKeys "%FX", True
        '// Restore back to last Dir
        .DisplayAlerts = True
    End With


Until I can find a way to to it without sendkeys.........
Seems like you can DO this via Clipboard object and the Use of the Shell/Shell NameSpace to get it to Paste as into a user selected Dir....
 
Upvote 0
BTW.......the method JPG mentions .......just use the code from the Html maker in order to Save the image file EXCEPT try with a differnt File extension......I don't think this will work ??? BUT I never tried it.
 
Upvote 0
Ivan F Moala said:
Until I can find a way to to it without sendkeys.........
Thanks, it works. To tell you the truth, I would like to use this function in an add-in.
So I hope you will find another way without sendkeys.

Ivan F Moala said:
BTW.......the method JPG mentions .......just use the code from the Html maker in order to Save the image file EXCEPT try with a differnt File extension......I don't think this will work ??? BUT I never tried it.
I have tried it but it did not work. :(

Anyway thanks for your reply!
 
Upvote 0

Forum statistics

Threads
1,222,092
Messages
6,163,866
Members
451,861
Latest member
Lurch65

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top