importing charts from excel

M

markrjl

When importing charts from a single excel sheet (pc ?office2004 or xp)
into ppt2004 some charts are ok, others lack the bars in the otherwise
ok bar chart. Any suggestions? Also, can anyone point me in the
direction of an applescript to automate this?
Thanks in advance.
 
J

Jim Gordon MVP

Hi,

Microsoft knows about a few oddities with bars in a few bar charts. It
wouldn't hurt to let them know that you are experiencing this problem.
Use the feedback feature on the Help menu.

Excel and PowerPoint are AppleScript-able. Have you dropped the Excel
and PowerPoint icons onto Script Editor to check the dictionaries?

-Jim
 
M

markrjl

Hi, thanks for the advice. I am very new to scripting but have started
on this. I have the dictionaries and am working on getting the script
to recognise the chart after I click on it. I have been able to import
part of other ppt scripts to open the program and make a ew slide but
no joy getting the chart from the clipboard yet!
 
P

Paul Berkowitz

Hi, thanks for the advice. I am very new to scripting but have started
on this. I have the dictionaries and am working on getting the script
to recognise the chart after I click on it. I have been able to import
part of other ppt scripts to open the program and make a ew slide but
no joy getting the chart from the clipboard yet!

The clipboard? Don't use the clipboard if you're doing this by script. This
is going to be pretty complicated, especially if you're a first-time
scripter. The dictionary is pretty complex here.

You're probably going to want to get the 'active chart' (see 'application'
in Excel Suite) if you've selected a chart . Then you'll (probably) be
dealing with the properties of 'chart' (rather than 'chart object') in the
Chart Suite - although you may need both.

I, on the contrary, know AppleScript pretty well (but these Office apps can
still be rather confusing) but have never worked with charts. If you want to
send me an example by email (remove "spoof" from my email address) plus
either a description or a barebones PowerPoint presentation explaining
where you want the chart inserted there, I'll see what I can come up with.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
M

markrjl

With considerable help from Paul Berkowitz this script copies the
charts from an excel worksheet to make powerpoint slides and adds a
slide title. Hope someone else finds it useful and develops it further.

display dialog "Type a title for slides:"
set slideTitle to text returned of (display dialog "Type a title for
slides:" default answer "Slide Heading")

tell application "Microsoft Excel"
activate
set pt to chart object 1 of active sheet
set r to 0

repeat with ci in (chart objects of active sheet)
set r to r + 1
tell application "Microsoft Excel"
copy object (chart object r of active sheet)

end tell

tell application "Microsoft PowerPoint"
activate

if not (exists presentation 1) then
set this_presentation to make new presentation
end if
tell presentation 1
tell slide master
set {s1Left, s1Top, s1Height, s1Width} to shape 1's {left
position, top, height, width}
set {s2Left, s2Top, s2Height, s2Width} to shape 2's {left
position, top, height, width}
end tell
set newSlide to make new slide at end --with properties
{layout:slide layout title slide}
tell newSlide
tell shape 1
set {left position, top, height, width} to {s1Left, s1Top,
s1Height, s1Width}
end tell
tell shape 2
set {left position, top, height, width} to {s2Left, s2Top,
s2Height, s2Width}
set visible to false
end tell
end tell

set newSlideIndex to slide index of newSlide
set view type of document window 1 to slide view
set theView to view of document window 1
go to slide theView number newSlideIndex
paste object theView
set view type of document window 1 to normal view
set content of text range of text frame of shape 1 of newSlide to
slideTitle
--"Surgery - Elective"

tell newSlide
set {s3Height, s3Width} to shape 3's {height, width}
if s3Width > s2Width then
tell shape 3 to set its width to s2Width
set s3Width to s2Width
end if
set s2Centre to (s2Width / 2) + s2Left
tell shape 3
if s3Height > s2Height then
set height to s2Height
set s3Width to width
end if
set left position to (s2Centre - (s3Width / 2))
set top to s2Top
end tell
end tell
end tell
activate
end tell
end repeat
end tell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top