Share via

Problems Saving Powerpoint Addin - misleading error message about ActiveX

Anonymous
2015-03-06T18:53:34+00:00

Recently I have tried to make an Addin from a completely functional .PPTM, whose purpose among other functions, is to take pre-built shapes saved on a Userform, and instill them onto the Presentation.

What I have found is that I can create an Addin with no warnings if -- and only if -- I do not run the code that copies images to the presentation, prior to saving as as a .ppam file. If I have run that code, then regardless that I clear out all objects and text from the .pptm, save, close, and re-open it - thereafter when attempting to Save as a .ppam file, I get an error message stating:

"Powerpoint cannot save this file as an addin because it contains activex controls"

Well:

  1) So far as I know, none of the forms contain anything but MSForms controls

  2) PPT has no problem saving as an Add-in so long as the pptm project is in pristine condition (ie, the shape building code were never run)

My only recourse so far has been to recreate the pptm file from scratch (exporting VBA components from the damaged file, into a new one)

I am wondering if others have suffered like affliction?

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Steve Rindsberg 99,166 Reputation points MVP Volunteer Moderator
2015-03-16T15:18:29+00:00

>> I add the shape only while testing the application. I remove it before trying to save as an Add-in; however it is too late, that seems to do something to the application which cannot be rescinded.

That's exactly what I'm telling you.  Once having added a forms control to the slide, PPT won't turn loose of the thing.  Watch the project in the VBA IDE.  When you add a forms control, you'll see a new Microsoft PowerPoint Objects section appear above the Modules section; any slide with a forms control will be listed there, even after the forms control itself has been deleted from the slide, and you won't be able to save as PPAM.

Saving the file (as PPTM) seems to force PPT to clear its head and remove any references to deleted ActiveX controls.  Just tested this here and after a save as PPTM I could then re-save as PPAM.

That may be all you need to do.  On the other hand, you'll probably be better off just inserting the images as images.  The whole problem (and other potential ones) will disappear.

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2015-03-15T19:50:30+00:00

    You are apparently not understanding what I am doing Steve.

    >>Or for that matter, to be adding anything to a slide in a presentation that will be saved as an add-in?

    I add the shape only while testing the application. I remove it before trying to save as an Add-in; however it is too late, that seems to do something to the application which cannot be rescinded.

    As for why I am inserting a control rather than a native Powerpoint shape - I am not a seasoned PPTM developer, this was the way I inherited the application. If native powerpoint shapes are the way to go, I will discuss that with other members of the programming team.

    Thank you.

    Was this answer helpful?

    0 comments No comments
  2. Steve Rindsberg 99,166 Reputation points MVP Volunteer Moderator
    2015-03-15T17:44:29+00:00

    As I mentioned, adding a forms control to a slide will prevent you from being able to save the presentation containing the slide as an add-in.

    And this:

    ActivePresentation.Slides(ActiveWindow.View.Slide.Name).Shapes.AddOLEObject(Left:=10, Top:=10, Width:=.Width, Height:=.Height, ClassName:="Forms.Image.1"

    seems to me to be adding a forms control to the slide.

    Is there some reason for inserting a control rather than a native PowerPoint picture shape?  Or for that matter, to be adding anything to a slide in a presentation that will be saved as an add-in?  Add-ins contain no slide content; the saved add-in contains none of the slide/master content from the original PPTM.  PPT's refusal to save as an add-in is probably there to protect us against developing solutions that are guaranteed not to work (ie, that depend on slide content/activeX on slides).  Expressed, though it may be, in typically MSoftian fashion.  Incomplete, incomprehensible and with a strong red-herring aroma.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-03-15T16:18:49+00:00

    Sorry, I lost track of the thread until MSFT reminded me the question remains unanswered. Forgive a newbie's negligence.

    In answer to your question Steve, it is a blank presentation. I can start with a blank presentation, add the forms, vba code, class modules, references, XML, and all the stuff that makes this powerpoint pptm file an "application" - it's all primed and ready to go. I can enable macros, and save it as a ppam file. And I can load it without errors, and even run it.

    And while it is an Add-in, since at that point it is never getting messed with or saved, it does fine to run its features, add shapes to presentations, save and close those presentations.

    But when modifying the original pptm , if I run the macros to copy images from the forms library to the presentation, I can't save the project as an addin - even if I strip it bare of any objects thereafter. This is an example of the routine that copies images

    Sub CopyImage(whichImage As String, Optional iLeft As Double, Optional iTop As Double)

        Dim frmX As frmFlags, desiredHeight As Double, desiredWidth As Double

        Dim objImage As Object, objGIF As Object

        Dim LineInterrupted As Integer

        On Error GoTo CatchCopyFlagError

        DoEvents: DoEvents

        If IsMissing(iLeft) Then iLeft = 40

        If IsMissing(iTop) Then iTop = 30

        Set frmX = New frmFlags

        Load frmX

        With frmX.Controls(whichImage)

            Set objImage = ActivePresentation.Slides(ActiveWindow.View.Slide.Name).Shapes.AddOLEObject(Left:=10, Top:=10, Width:=.Width, Height:=.Height, ClassName:="Forms.Image.1", Link:=msoFalse)

            objImage.OLEFormat.Object.Picture = .Picture

        End With

        With objImage

            'MsgBox "Height: " & .Height & ", Width: " & .Width, vbOKOnly

            desiredWidth = 20

            desiredHeight = 20 * .Height / .Width

            .OLEFormat.Object.AutoSize = True

            .LockAspectRatio = False

            If Application.Version >= 15 Then 'modified for Global Desktop 1.5

                .OLEFormat.Object.PictureSizeMode = fmPictureSizeModeStretch

            Else

                .OLEFormat.Object.PictureSizeMode = fmPictureSizeModeZoom

            End If

        End With

        objImage.Copy

        LineInterrupted = 100

        If Application.Version >= 15 Then 'modified for Global Desktop 1.5

            'ActiveWindow.View.PasteSpecial

            ActiveWindow.View.PasteSpecial datatype:=ppPasteEnhancedMetafile

        Else

            ActiveWindow.View.PasteSpecial datatype:=ppPasteGIF

        End If

        LineInterrupted = 10

        objImage.Delete

        LineInterrupted = 2

        Set objGIF = Application.ActiveWindow.View.Slide.Shapes(Application.ActiveWindow.View.Slide.Shapes.Count)

        If Application.Version >= 15 Then 'modified for Global Desktop 1.5

            With objGIF

                .Top = iTop - 9

                .Left = iLeft - 1 

                .Height = desiredHeight

                .Width = desiredWidth

                .Line.Visible = msoTrue

                .Line.ForeColor.RGB = RGB(192, 192, 192) 

                .Line.Weight = 2    '0.5

            End With

        Else

            With objGIF

                .Top = iTop - 9

                .Left = iLeft - 1 

                .Height = desiredHeight

                .Width = desiredWidth

                LineInterrupted = 3

                .Line.Visible = msoTrue

                .Line.ForeColor.RGB = RGB(192, 192, 192)  

                .Line.Weight = 2    '0.5

            End With

        End If

        Unload frmX

        Set frmX = Nothing

        Exit Sub

    CatchCopyFlagError:

        MsgBox Err & ":(" & LineInterrupted & ")  " & Error, vbOKOnly

    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Steve Rindsberg 99,166 Reputation points MVP Volunteer Moderator
    2015-03-07T05:17:24+00:00

    I can easily replicate this with a new blank presentation by adding any of the forms controls to a slide in the presentation.  Nothing more.  Saving as PPAM gives me the same message.

    So my first question would be:  does your code add any activex/aka forms controls to any of the slides in the presentation when it runs?  If so, you'll need to delete the controls before saving as PPAM.

    Was this answer helpful?

    0 comments No comments