Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Office2003 - Set Plot Area's fill image

Office2003 - Set Plot Area's fill image

Scheduled Pinned Locked Moved Visual Basic
questionhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    john john mackey
    wrote on last edited by
    #1

    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

    Q 1 Reply Last reply
    0
    • J john john mackey

      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

      Q Offline
      Q Offline
      quacks_a_lot
      wrote on last edited by
      #2

      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[^]

      J 2 Replies Last reply
      0
      • Q quacks_a_lot

        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[^]

        J Offline
        J Offline
        john john mackey
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • Q quacks_a_lot

          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[^]

          J Offline
          J Offline
          john john mackey
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups