Discussion Locked

Create a bmp file from Excel

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Understood that Excel Chart can be exported as a gif file programmatically with the following coding in Visual Basic:
sub Create_GIF()
Dim mychart As Chart
Set mychart = ActiveSheet.ChartObjects(1).Chart
mychart.Export FileName:="c:\Mychart.gif",FilterName:="GIF"
End Sub

(After run the Macro a gif file will be created.)

Can a photo(in bmp or gif) attached in Excel be exported? If yes, how?

5 replies

by s_khanna

If it makes a gif file for you, then all u hav to do is just copy the gif file from the same folder that the excel (xls etc.)file is in to whereverer you want it to be.

by sankulpune

Hello Chan,

The following code will help you to 'export' (save as a different file) a bmp picture in your excel worksheet ("Sheet1")

Open the workbook. Select the bmp picture you want to export and run the following macro (pasted in the VBE of'Sheet1').

However, you need to do a few things manually (because PaintBrush has no object model or I was unable to locate it.)

When PaintBrush opens, click Edit > Paste and save the file. Then close PaintBrush to return to Excel.

Sub exportBmp()
' Exports bmp in Excel.
Dim ws As Worksheet
Dim bmpPic As OLEObject
Set ws = ActiveWorkbook.Sheets("Sheet1")
Set bmpPic = Selection
bmpPic.CopyPicture xlScreen, xlBitmap
Shell "pbrush.exe", vbNormalFocus
End Sub

Your feedback willbe highly appreciated.

With regards,

SanganakSakha
Simple And Effective Solutions To Small Problems, No QuickFixes.

This discussion is closed to new replies.