ikervb
ikervb

Reputation: 11

Code to export control image to bmp file

I am trying to export a button bmp data to a bmp file.

For example, suppose I have assigned an image to a button using the wizard, Then I want some code to export that image to the filesystem (image.bmp).

Is there a simple instruction or instructions for that?

Upvotes: 0

Views: 887

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123409

You can retrieve the bitmap image data by using the .PictureData property of the Command button, and then write the data to a .bmp file using an ADODB.Stream object:

Dim strm As New ADODB.Stream
strm.Type = adTypeBinary
strm.Open
strm.Write Me.Command0.PictureData
strm.SaveToFile "C:\Users\Gord\Desktop\ButtonImage.bmp"
strm.Close
Set strm = Nothing

Upvotes: 1

Related Questions