Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting current slide title in PowerPoint 2004



I'm trying to fetch the title from PowerPoint 2004 slide. It seems that there is no direct way to access the title, and you actually have to search through the shapes for a one of the title placeholders types, and get the text from its text frame. This search become slow if the slide contain many shapes.

I use this code:

set slideTitle to ""

set titleTypes to {placeholder type title placeholder, placeholder type center title placeholder, placeholder type vertical title placeholder}

-- Get the text of the first title placeholder
repeat with i from 1 to count of shapes of currentSlide
set aShape to shape i of currentSlide
set aType to placeholder type of aShape
if aType is not missing value and titleTypes contains aType then
set slideTitle to content of text range of text frame of aShape
exit repeat
end if
end repeat



In Visual Basic, you can access the title as:

	ActivePresentation.Slides(number).Shapes.Title.TextFrame.TextRange

So I tried to run this with do Visual Basic, but the script does not return anything. The dictionary says:

	do Visual Basic v : Execute a Visual Basic script
		do Visual Basic string : The script to execute
		→ anything : the result of the script

But in reality, "anything" turns out to be "nothing". I really like this kind of docs!

I made little research, and found this article: http://word.mvps.org/ mac/Applescript-VBA.html. It seems that the only way to return result from do visual basic is by writing it to a file in VBA, and reading the file elsewhere.

But I guess that do visual basic is not the way as Microsoft is killing VBA in the next Office for Mac anyway.

I wonder if anyone can come up with an easier and faster way to fetch the title?


Best Regards,

Nir Soffer

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.