PPT 2007: Unable to export slides as .pptx files

D

Dave Jenkins

I'm trying to save selected slides using code that must run on PPT 2007 and
PPT 2003. Here's a copy of the pertinent code that I've been dinking with:

' Create a FileDialog object as a File SaveAs dialog box.
' fd.SelectedItems(1) will be name of file to save as
Set fd = Application.FileDialog(msoFileDialogSaveAs)

'Use a With...End With block to reference the FileDialog object.
With fd

If val(Application.Version) < 12 Then
.InitialFileName = ActivePresentation.Path & "\slides.ppt"
Else
.InitialFileName = ActivePresentation.Path & "\slides.pptx"
End If
.Title = "Slide Subset Save"

For i = 1 To .Filters.Count
If val(Application.Version) < 12 Then
If .Filters(i).Description = "PowerPoint 97-2003 Presentation"
Then
.FilterIndex = i
Exit For
End If
Else
If .Filters(i).Description = "PowerPoint Presentation" Then
.FilterIndex = i
Exit For
End If
End If
Next i

'Use the Show method to display the File Picker dialog box and return
the user's action.
'The user pressed the button.
If .Show = -1 Then ' save

If val(Application.Version) < 12 Then
ActiveWindow.Selection.SlideRange.Export fd.SelectedItems(1),
"PPT"
Else
===> ActiveWindow.Selection.SlideRange.Export fd.SelectedItems(1), "PPTX"
End If

End If

End With

Set fd = Nothing
Exit Sub


If the indicated statement reads "PPTX" I get a runtime error saying no
filter exists for "PPTX." If use "PPT" then I get a filename of the form
"filename.pptx.ppt". I have jimmy everything so that it specifies "PPT" then
I can get a file of the form "filelname.ppt"

BTW, this routine wants to create a new presentation using slides selected
in the thumbnail pane. It only seems to export one slide, however. Can I
even do what I want?

And lastly, PowerPoint crashes everytime I exit this sub, regardless of the
number of slides selected - what's up with that?

Thanks.
 
S

Steve Rindsberg

Never believe everything you see in print.
Place even less faith in anything you see in help files.
That goes double for VBA help files.
Double again for PPT VBA help files.
Double once more for PPT 2007 VBA help files.

The info re .Export and slide ranges is wrong. It claims that it will export to
the provided path, giving exported graphic files names like "Slide1.png" and so
on. It won't. It'll export single slides to the name you supply. Supply just
the path and it errors. Note that they supply no CODE example of this
particular usage. Hmmm.

Exporting a slide range to a multi-slide format like PPT is reasonable, but
there the gotcha that .Export allows you to specify a graphics filter. While
they don't come right out and say it, PPT/PPTX/POT'n'that LOT aren't considered
graphics files. JPG, PNG and such are. Hence the "No filter" error.

You might be better off saving a copy of the file under the chosen name,
deleting all slides that aren't in the selected range (going from back to front
of file) then resaving.
 
D

Dave Jenkins

That's exactly what I'll do, Steve. (Sounds like you've been there. Done
that.)

Although the way you suggest is kludgy (that is, compared to the way it
*ought* to be supported/implemented by MS) I at least have a shot at getting
it done without having to repeatedly take the Lord's name in vain for the
next few nights.

Thanks.
 
S

Steve Rindsberg

Dave Jenkins said:
That's exactly what I'll do, Steve. (Sounds like you've been there. Done
that.)

Got the bloodstained t-shirt too.
Although the way you suggest is kludgy (that is, compared to the way it
*ought* to be supported/implemented by MS) I at least have a shot at getting
it done without having to repeatedly take the Lord's name in vain for the
next few nights.

And kludgy or not, it'll still be quite fast.
 
S

Steve Rindsberg

John Wilson said:
"Got the bloodstained t-shirt too. "

Not your new one I hope ;0)

Holding that in reserve for beer stains. said:
(The Trish Elve's have lerned spelin and made a new one)

Is that the plural of "Elvis"?
 
S

Steve Rindsberg

No, it's Elvis possessed. By what, we don't know.

Corel? (You used to be able to do some magic keystroke 'n click dance in the
About box to get a display of Elvi in their splendid Zillions parachuting into
Vegas).
 

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