473,785 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

9 New Member
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 4628
Guido Geurs
767 Recognized Expert Contributor
@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
atiullah
9 New Member
'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.PlotAr ea.Fill.UserPic ture PictureFile:=Bi ldName

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 Recognized Expert Top Contributor
Hi,

I think it is "ChartArea" :

diagramm.ChartA rea.Fill.UserPi cture PictureFile:=Bi ldName

Regards
Veena
May 20 '10 #4

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

Similar topics

1
6196
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 queries. A number of fields in the queries are designed to become formulae in Excel after the export has taken place (and they need to be in Excel rather than Access). I need to use the TransferSpreadsheet Method rather than the OutputTo to enable...
1
2047
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. Can anyone provide me references or examples ffro the same.
2
12454
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 tried...and finally i am here.... help me. musa.biralo
0
1580
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 works properly but if i use a macro and make the excel password protected then it does not allow me to open it. It does not give any exception but on reaching to "oWB = oXL.Workbooks.Open(" it hangs up. Private Sub Page_Load(ByVal sender As...
1
4822
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 last): File "C:\Documents and Settings\kusumap\Desktop\Girish.py", line 7, in ? worksheet.OLEObjects.Add(Filename="C:\Documents and Settings
1
10506
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 trying to export to Excel using a command in an Access Form. RowID strFY AccountID CostElementWBS 1 2008 1 7 2 2008 1 7 I want to...
0
1915
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 the excel by using OLE or Msflexgrid.. i am very confuse..hope u can give me some tip on how should i plot my graph using the visual basci interface. here i gave my program: Option Explicit Dim Excel As Object Dim ExcelSheet As Object Dim...
1
4145
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 or easy way to maintain. cheers
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.