Saturday, November 24, 2012

How to make image out of Excel chart in VBA?

After figuring out the code to generate image out of ranges (click here to see) I did some research to figure out how to make image out of a chart. It turned out to be pretty much similar.


Sub Chart_Image()

'DEFINE THE CHART VARIABLE
Dim chart As chart

'SELECTING THE ACTIVE CHART
Set chart = ActiveChart

'COPYING THE RANGE TO AS BITMAP INMEMORY
chart.CopyPicture xlScreen, xlBitmap

'PASTING THE INMEMORY IMAGE TO THE WORKSHEET
ActiveSheet.Paste

End Sub



How to make image out of Excel range in VBA?

One of my colleague one day came to me to figure out how can someone generate an image out of an Excel range in VBA as he found it difficult. I did little research around it and came out with following. 


Sub Range_Image()

'DEFINE THE RANGE VARIABLE
Dim range As range

'SELECTING A PREDEFINED RANGE FROM ACTIVE WORKSHEET
Set range = ActiveSheet.range("A1:C3")

'COPYING THE RANGE TO AS BITMAP INMEMORY
range.CopyPicture xlScreen, xlBitmap

'PASTING THE INMEMORY IMAGE TO THE WORKSHEET
ActiveSheet.Paste

End Sub



Sunday, November 18, 2012

Android Tips & Tricks

Hi Friends,

To help people who have newly bought their Android phones to get up to the speed and use their devices efficiently I have dedicated a new blog for it called MeraDroid.blogspot.com. Please do visit and have a look.

http://meradroid.blogspot.in/


Thanks!
Samir