Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm looking for some VBA code that will take an appropriately scaled
matrix and turn it into a saved image file of some sort (e.g., BMP). Can anyone help? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim
See Harald's code on David's site http://www.mvps.org/dmcritchie/excel/xl2gif.htm Or use this small example to save the selection in C:\ Sub Testing() Application.ScreenUpdating = False Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture Set ctoTheChartHolder = ActiveSheet.ChartObjects.Add(0, 0, 800, 600) Set chtTheChart = ctoTheChartHolder.Chart ' Paste the picture onto the chart and ' set an object variable for it ctoTheChartHolder.Activate With chtTheChart .ChartArea.Select .Paste Set picThePicture = .Pictures(1) End With ' Set the picture's properties... With picThePicture .Left = 0 .Top = 0 sglWidth = .Width + 7 sglHeight = .Height + 7 End With ' Change the size of the chart object to fit the picture 'better With ctoTheChartHolder .Border.LineStyle = xlNone .Width = sglWidth .Height = sglHeight End With ' Export the chart as a graphics file blnRet = chtTheChart.Export(Filename:="c:\range.gif", _ FilterName:="gif", Interactive:=False) ctoTheChartHolder.Delete Application.ScreenUpdating = True End Sub -- Regards Ron De Bruin http://www.rondebruin.nl "Jim" wrote in message ups.com... I'm looking for some VBA code that will take an appropriately scaled matrix and turn it into a saved image file of some sort (e.g., BMP). Can anyone help? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Ron. That is some cool stuff. I love it.
But, I guess I wasn't clear about what I wanted. I'd like to create a gif or a bmp from an array such that each element of the array contains the color of a single pixel. For instance in a really simplified example, I'd like to convert the array {0,63,127,255} into a 1 x 4 image gray-scale image. Do you have any help for this problem? Thanks, Jim |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you have any help for this problem?
No, sorry -- Regards Ron De Bruin http://www.rondebruin.nl "Jim" wrote in message ups.com... Thanks Ron. That is some cool stuff. I love it. But, I guess I wasn't clear about what I wanted. I'd like to create a gif or a bmp from an array such that each element of the array contains the color of a single pixel. For instance in a really simplified example, I'd like to convert the array {0,63,127,255} into a 1 x 4 image gray-scale image. Do you have any help for this problem? Thanks, Jim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a "sensitive regions" image on a form | Excel Programming | |||
Can I get a chart to an image file? | Excel Programming | |||
Creating image which refer to a section of another sheet | Excel Programming | |||
Export the worksheet background image as an image file - possible? | Excel Programming | |||
Resizing an image file | Excel Programming |