View Full Version : add-in error with checkbox value
bonneyh
07-22-2010, 06:45 PM
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? :banghead:
John Wilson
07-23-2010, 08:21 AM
You need to post more of your code.
bonneyh
07-23-2010, 02:17 PM
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
John Wilson
07-23-2010, 11:05 PM
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
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
bonneyh
07-24-2010, 01:08 AM
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
John Wilson
07-24-2010, 01:58 AM
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
bonneyh
07-24-2010, 04:08 AM
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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.