Win32ole question

I have a bunch of single-slide powerpoint files and want to save each one as
a .png file.

Powerpoint "save as" does the trick and I can invoke it via win32OLE ... but
when executed interactively it throws up a dialog box asking "do you want to
export every slide in the presentation or just the current slide". I want
"just the current slide" but don't know how (or if) I can do that from my
Ruby script, since this is not a parameter to #saveAs.

I suspect it can't be done. Hope I'm wrong :frowning:

Well, when I've done something with Excel and win32ole and wanted to
stop annoying "Do you want to save changes?" type dialogs, I was able
to do @excel.DisplayAlerts = false. However, this a) may be excel
specific and b) even if it's not, may not be applicable here. In doing
some IE scripting (not necessarily using win32ole), I've gotten around
some annoying dialogs by also using WScript.Shell OLE objects to
select the window by title, and then send a certain keypress to
dismiss the dialog:

@sh = WIN32OLE.new('WScript.Shell')
until(@sh.AppActivate('Window Title Here')
end
@sh.SendKeys('%{F4}') # Sends Alt-F4

It's a bit hackish (the until loop is for cases where I hit this code
before the target window has been created, stuff like that), and is
sensitive to breakage if run on a computer where other things are
being done simultaneously, but can be made to work.
-Patrick

···

On 11/10/05, itsme213 <itsme213@hotmail.com> wrote:

I have a bunch of single-slide powerpoint files and want to save each one as
a .png file.

Powerpoint "save as" does the trick and I can invoke it via win32OLE ... but
when executed interactively it throws up a dialog box asking "do you want to
export every slide in the presentation or just the current slide". I want
"just the current slide" but don't know how (or if) I can do that from my
Ruby script, since this is not a parameter to #saveAs.

I suspect it can't be done. Hope I'm wrong :frowning:

Hi,

I found a few remarks on the Internet regarding using the "Export"
method rather than "Saveas", maybe worth a try....
(I googled for "powerpoint vba export png")

Regards, Bernhard

I don't think this will work for me since I only get the pop-up in
interactive (manual) mode. When scripting (Ruby or VB) the pop-up does not
appear at all, instead defaulting to "every slide", which is not what I
want.

But thanks for the tips, I am certain they will come in handy!

"Patrick Fernie" <patrick.fernie@gmail.com> wrote in message
news:240187340511092159s3e629bc9t1ee7c686c924075a@mail.gmail.com...
Well, when I've done something with Excel and win32ole and wanted to
stop annoying "Do you want to save changes?" type dialogs, I was able
to do @excel.DisplayAlerts = false. However, this a) may be excel
specific and b) even if it's not, may not be applicable here. In doing
some IE scripting (not necessarily using win32ole), I've gotten around
some annoying dialogs by also using WScript.Shell OLE objects to
select the window by title, and then send a certain keypress to
dismiss the dialog:

@sh = WIN32OLE.new('WScript.Shell')
until(@sh.AppActivate('Window Title Here')
end
@sh.SendKeys('%{F4}') # Sends Alt-F4

It's a bit hackish (the until loop is for cases where I hit this code
before the target window has been created, stuff like that), and is
sensitive to breakage if run on a computer where other things are
being done simultaneously, but can be made to work.
-Patrick

···

On 11/10/05, itsme213 <itsme213@hotmail.com> wrote:

I have a bunch of single-slide powerpoint files and want to save each one
as
a .png file.

Powerpoint "save as" does the trick and I can invoke it via win32OLE ...
but
when executed interactively it throws up a dialog box asking "do you want
to
export every slide in the presentation or just the current slide". I want
"just the current slide" but don't know how (or if) I can do that from my
Ruby script, since this is not a parameter to #saveAs.

I suspect it can't be done. Hope I'm wrong :frowning:

Thanks a bunch, this works perfect:

ppt.activePresentation.slides.item(1).export 'foo.png', 'png'

<bernhard.leicher@degussa.com> wrote in message
news:1131615543.768113.250510@o13g2000cwo.googlegroups.com...

···

Hi,

I found a few remarks on the Internet regarding using the "Export"
method rather than "Saveas", maybe worth a try....
(I googled for "powerpoint vba export png")

Regards, Bernhard