What to do with this VBA code

T

Tod

I have the code following this post, that was gathered
from various sources on the Internet. It converts all of
the linked objects into pictures, then saves the
presentation using the user-defined file name. Problem is
that it's in the the vba module of the presentation. I'd
like to make this into a tool or script or something so
that the user is prompted to open a presentation then have
it do the do on THAT presentation.

Any help appreaciated,

tod

Here is the code:

Sub Main()
Call BreakLinks
Call SaveAsDialog
End Sub
Sub BreakLinks()
Dim oSld As Slide
Dim oShp As Shape
Dim oCmdButton As CommandBarButton
Set oCmdButton = CommandBars("Standard").Controls.Add
(Id:=2956)
ActiveWindow.ViewType = ppViewSlide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoLinkedOLEObject Then
ActiveWindow.View.GotoSlide oSld.SlideIndex
oShp.Select
Application.CommandBars.FindControl
(Id:=2956).Execute
DoEvents
End If
Next oShp
Next oSld
oCmdButton.Delete
End Sub
Sub SaveAsDialog()
With Application.FileDialog(ppFileDialogSave)
' Set file filter flags
Call .Extensions.Add("*.PPT", "PowerPoint
Presentation")
Call .Extensions.Add("*.PPS", "PowerPoint Show")
.ActionButtonName = "Open"
.DefaultDirectoryRegKey = "Default"
.DialogTitle = "Open"
.DirectoriesOnly = False
.InitialView = ppFileDialogViewPreview
.IsMultiSelect = False
.IsPrintEnabled = False
.IsReadOnlyEnabled = True
.OnAction = "ProcessSelection"
.UseODMADlgs = False
.Launch
End With
End Sub
Sub ProcessSelection(ByVal oDlg As FileDialog)
If oDlg.Files.Count = 0 Then Exit Sub
ActivePresentation.SaveAs FileName:=oDlg.Files(1)
End Sub
 

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