Consulting

Results 1 to 7 of 7

Thread: add-in error with checkbox value

  1. #1
    VBAX Newbie
    Joined
    Jul 2010
    Posts
    4
    Location

    Question add-in error with checkbox value

    I have vba code that gets values from the checkboxes on a slide using Oleformat.object.value. however when I save this code as an add-in in a ppam file and load that ppam into a powerpoint presentation the code fails with the message oleformat object failed. Why does this code work in a module but not as an add-in?

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You need to post more of your code.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Newbie
    Joined
    Jul 2010
    Posts
    4
    Location
    Hi John

    I have a blank presentation which contains quite a bit of code which I was hoping to make into a ppam that could be loaded into a storyboard presentation. The bit of code that it fails on is:

    Dim i As Integer
    'checkboxes
    For i = 0 To 21
    oPPTest.SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value = Presentations(1).Designs(1).SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value
    oPPSumm.SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value = Presentations(1).Designs(1).SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value

    Next i

    The code creates two new presentations call oPPTest and oPPSumm and I am trying to copy information from the storyboard presentation into the two new ppt files. Everything works fine when I have the storyboard open and the add-in code in a separate pptm file. However when I compile the code into a ppam file and try to run the code from a button on the ribbon, the code fails

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    My guess is Presentations(1) is the problem. Is this always the storyboard?

    I would have code that sets the Active Presention to an object var BEFORE oponing the two new presentations

    [vba]Dim oSource As Presentation
    Set oSource = ActivePresentation

    .......'open oPPTest etc

    oPPTest.SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value = oSource.Designs(1).SlideMaster.Shapes("CheckBox" & i + 1).OLEFormat.Object.Value
    [/vba]
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Newbie
    Joined
    Jul 2010
    Posts
    4
    Location
    Thanks for that idea - I will add that code in but I know that it is picking up the right presentation as the other textboxes are being updated correctly. The error is about the Oleformat.object.value and I am not sure about activex objects being inserted in an add-in. Could that be the problem and if so is there any way around it?

    Thanks again

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Works from an AddIn here. How are you calling the AddIn code? Have you written xml to create a ribbon entry or a macro to create a menu / toolbar.

    Do you get an error message?

    Ideally code should be

    oPPSumm.SlideMaster.Shapes("CheckBox" & CStr( i + 1)) 'ie convert integer to string

    But I don't see why your code would actually fail

    John

    Post me the ppam if you want john ATSIGN pptalchemy.co.uk
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    VBAX Newbie
    Joined
    Jul 2010
    Posts
    4
    Location
    I am writing a macro in vba and saving the file as a ppam. Then I goto powerpoint options and add the add-in by browsing to its location. The error given is oleformat.object.value failed. I am back into work on Monday and will try your suggestions then. Thanks for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •