1. moritz nölting
  2. PowerBuilder
  3. Monday, 19 February 2018 09:07 AM UTC

hi,

i'm creating an excel-sheet with an chart, no problem so far. im also creating a chart in it and i want to change the default color for the legend-objects.

the problem is that i found no way how it works, maybe anyone can help me?

 

lole_app.ActiveChart.Legend.Select
lole_app.ActiveChart.Legend.LegendEntries(1).Select
lole_app.Selection.Format.Line.ForeColor.RGB = RGB(0, 176, 80)
lole_app.Selection.Format.Fill.ForeColor.RGB = RGB(0, 176, 80)

the error is that line can't be accessed, but in the excel-macro and documentation it is line or fill...

 

thanks

moritz

Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 19 February 2018 13:21 PM UTC
  2. PowerBuilder
  3. # 1

Hi Moritz,

What I do when I struggle getting OLE Automation syntax correct for MS Word or MS Excel:

  1. Start MS Excel (similar for MS Word)
  2. Start recording a macro
  3. Perform the action manually that I want to code in PowerScript
  4. Stop the macro
  5. Edit the macro - voila!
    1. You may find the object model in Excel slightly differs from your expectations
    2. You may find you should use an array reference
    3. The macro editor also displays the constants you  can use

For details on specific object APIs there is a lot of online documentation but the API is overwhelming. Using the macro editor to pinpoint what to search for is a great time saver.

 

HTH /Michael

Comment
  1. moritz nölting
  2. Monday, 19 February 2018 15:20 PM UTC
i've tried it this way. thats why i use format.line and format.fill, in vb it works but not from powerbuilder

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.