473,320 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

add picture in the background of plot area in ms excel using vb macro

I want to insert a picture in the background of the plot area in ms excel using visual basic macro...How can it be done..Please help
May 19 '10 #1
3 4605
Guido Geurs
767 Expert 512MB
@atiullah
dear,

This insert a picture but it's not in the background !!!

Expand|Select|Wrap|Line Numbers
  1. Sub Macro1()
  2. '§ insert picture
  3.     ActiveSheet.Pictures.Insert( _
  4.         "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg" _
  5.         ).Select
  6. '§ scale width and height
  7.     Selection.ShapeRange.ScaleWidth 1.91, msoFalse, msoScaleFromTopLeft
  8.     Selection.ShapeRange.ScaleHeight 1.91, msoFalse, msoScaleFromTopLeft
  9. End Sub
This sets a background:

Expand|Select|Wrap|Line Numbers
  1.     ActiveSheet.SetBackgroundPicture Filename:= _
  2.         "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"
br,
May 19 '10 #2
'get the backgrund image in plot area
BildName = ActiveWorkbook.Name
BildName = Left(BildName, 9) & Datenblatt.Name & ".jpg"
#If Mac Then
BildName = ActiveWorkbook.Path & ":JPG:" & BildName
#Else
BildName = ActiveWorkbook.Path & "\JPG\" & BildName

#End If
diagramm.PlotArea.Fill.UserPicture PictureFile:=BildName

the last line in the code works on excel 2001 but doesnt work on excel 2003 or 2007. please tell me the replacement of the last line so that it works in excel 2007.< diagramm> is a chart object and <BildName> is the path of picture which has to be inserted..I m really stuck plz help
May 20 '10 #3
QVeen72
1,445 Expert 1GB
Hi,

I think it is "ChartArea":

diagramm.ChartArea.Fill.UserPicture PictureFile:=BildName

Regards
Veena
May 20 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: barma16 | last post by:
I've hit a bit of a brick wall here, and could use some advice. I have an Access application whose output is a four-tab Excel spreadsheet where three of the four tabs are the result of database...
1
by: shinde.shailesh | last post by:
Hi All, I have an xls file which contains data in one column. Also Having .MDB file with Table name "TableTest" and one field "Tabletst". I ahve to extract data from xls to MDB using Macro. ...
2
by: musa.biralo | last post by:
Hi, i want to read each row of specific column of musa.dbf using macro (VBA) in excel. my main gole is to copy the data of dbf file to excel file. I am new but want to do something..i tried and...
0
by: guptasourav | last post by:
I am opening an Excel file on my server, and saving it with some other name and then trying to coping the new excel to my local machine. If i use a simple Excel(without macro but with password) it...
1
by: Girish | last post by:
Hi, I want to embed a txt document into an excel using python. Here is my code, but i get an error message =================================================== Traceback (most recent call...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
0
by: wankhusairi | last post by:
hallo sir .. i am still new on using vb and i have tried to load an excel using a visual basic interface.. but if i wanted to plot my excel data what should i do.. must i cahnge my program on loading...
1
by: idealfellow | last post by:
Hi All, I need to delete entire column(GB) in excel using ruby code. let me whether i should write some ruby code or is there a way to call an excel macro from ruby whichever is simpler...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.