Showing posts with label Add image as background to chart using VBA. Show all posts
Showing posts with label Add image as background to chart using VBA. Show all posts

Saturday, January 19, 2013

Add image as background to chart using VBA

If you want to add an image to the chart as background . Try this macro




Sub add_image_background()

Dim cht As Chart
Dim imgpath As String

imgpath = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\blue hills.jpg"

'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart

With cht.ChartArea
    .Fill.UserPicture PictureFile:=imgpath
    .Fill.Visible = True
End With

End Sub

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...