Making excel charts into powerpoint slides (Office 2004)

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.

(also posted in Powerpoint discussion group)

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