• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Excel Charts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Excel Charts


  • Subject: Re: Scripting Excel Charts
  • From: dev_sleidy <email@hidden>
  • Date: Fri, 4 Aug 2006 18:01:12 -0400

Can someone please get me started with an example on how to script an Excel chart? ... I want to make a simple bar chart with jobs listed on the left ... Also a 3-D pie chart of above Data.

Although not exactly as requested, nor complete - here is some working sample code to start with.


( MacOS X v. 10.4.4, Excel v. 11.2. )

----- Code starts here -----

tell application "Microsoft Excel"
 activate

 if (not (document 1 exists)) then make new document

 set tJobs to {"Job A", "Job B", "Job C"}
 set tTimes to {"02:07:25", "01:24:55", "02:42:18"}

 repeat with i from 1 to (count tTimes)
  set (value of cell 1 of row i) to (item i of tJobs)
  set (value of cell 2 of row i) to (item i of tTimes)
 end repeat

 select range "A1:B3"

 set tChart to make new chart at beginning of active workbook
 set tChart to active chart

 tell tChart
  set chart type to bar clustered
  set plot by to by columns

  set has title to true
  set caption of its chart title to "Job Times - Bar Chart"

  set has legend to false
 end tell

 set tChart2 to make new chart at beginning of active workbook
 set tChart2 to active chart

 tell tChart2
  set chart type to ThreeD pie exploded
  set plot by to by columns

  set has title to true
  set caption of its chart title to "Job Times - Pie Chart"

  set has legend to false
 end tell
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Scripting Excel Charts (From: Steven Valenti <email@hidden>)

  • Prev by Date: Re: Problem with scripting ARD
  • Next by Date: Re: Scripting Excel Charts
  • Previous by thread: Scripting Excel Charts
  • Next by thread: Re: Scripting Excel Charts
  • Index(es):
    • Date
    • Thread