Office2003 - Set Plot Area's fill image
-
Hi. I wrote some VBA code in Office 2000, MS Access, that calls Excel, creates a plot, and then sets the background image for the plot
Set coChartObject = wsWorksheet.ChartObjects(1) coChartObject.Chart.PlotArea.Fill.UserPicture ("c:\images\Bkgrnd1") coChartObject.Chart.PlotArea.Fill.Visible = True
When I try to run this code in Office 2003, I get an error on the line that sets my background image - it doesn't recognize the function. I was able to "Watch" this object and when I tried to expand its structure, I can only get to the "Fill" field - there is NO "UserPicture" field under the Chart object in Office 2003 How do I set the PlotArea's background image in Office2003/VBA code? Thanks, Johnny -
Hi. I wrote some VBA code in Office 2000, MS Access, that calls Excel, creates a plot, and then sets the background image for the plot
Set coChartObject = wsWorksheet.ChartObjects(1) coChartObject.Chart.PlotArea.Fill.UserPicture ("c:\images\Bkgrnd1") coChartObject.Chart.PlotArea.Fill.Visible = True
When I try to run this code in Office 2003, I get an error on the line that sets my background image - it doesn't recognize the function. I was able to "Watch" this object and when I tried to expand its structure, I can only get to the "Fill" field - there is NO "UserPicture" field under the Chart object in Office 2003 How do I set the PlotArea's background image in Office2003/VBA code? Thanks, JohnnyDoes coChartObject.Chart have a ChartArea property? I was looking around on MSDN for some help on that. Maybe this page will help you. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlmthUserTextured1_HV05205759.asp[^]
-
Does coChartObject.Chart have a ChartArea property? I was looking around on MSDN for some help on that. Maybe this page will help you. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlmthUserTextured1_HV05205759.asp[^]
In Office2003, I'm using the Object Browser (F2) in VBA coding window to see what's available. When I search for my coChartObject (dim'd coChartObject As ChartObject), I don't see Chart as a member. This is probably why failing in Office/Access 2003 VBA code. Here are my dim statements and code that worked in 2000 (again)
Dim wsWorksheet As New Excel.Worksheet Dim coChartObject As ChartObject ... Set wsWorksheet = oXLApp.Parent.Worksheets("XYplot") wsWorksheet.Activate ... Set coChartObject = wsWorksheet.ChartObjects(1) coChartObject.Chart.PlotArea.Fill.UserPicture (strImagePathname) 'FAILS HERE in 2003 coChartObject.Chart.PlotArea.Fill.Visible = True
At this point, I'm not worried about backward compatability - I just want to set a background image in Office 2003 (from VBA code in MS Access directing MS Excel.) Huge thanks to all who can help. will check link above Johnny -
Does coChartObject.Chart have a ChartArea property? I was looking around on MSDN for some help on that. Maybe this page will help you. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlmthUserTextured1_HV05205759.asp[^]
Ok, I am really frusterated because I can't get the right "Chart", "Charts(i)" or parent object to do:
Charts(2).ChartArea.Fill.UserTextured "image.gif"
In Office2003/VBA Object Browser, I typed in "UserTextured" to find what object I should use and worked my way up. Still no success :((
At my disposal are:dim oXLApp as Object Set oXLApp = GetObject(,"Excel.Application") 'yadda yadda yadda ... Set oXLApp = GetObject("MyExcel.xls") ... dim wsWorksheet As New Excel.Worksheet dim coChartObject as ChartObject dim chChart as New Excel.Chart 'added in vain, but to no avail ... Set wsWorksheet = oXLApp.Parent.Worksheets("XYPlot") wsWorksheet.Activate ... Set coChartObject = wsWorksheet.ChartObjects(1) ' old stuff works in 2000, but not office 2003 ... '**Tried unsuccessfully** Set chChart = oXLApp.Charts(0) 'anything I put for index failed chChart.ChartArea.Fill.UserTextured ("myImage.gif") 'failed! coChartObject.Chart.ChartArea.Fill.UserTextured ("myImage.gif") Set chChart = coChartObject.Chart ...
Argh! This is really chapping my hide X| Johnny