behest
asked on
PowerPoint AddIn/Custom Ribbon generating macro error
Howdy! I've set up an AddIn in PowerPoint that generates a custom menu on the ribbon with macros assigned to buttons. When I open the AddIn or the original .pptm used to create it, PowerPoint tells me..."The macro cannot be found or has been disabled because of your security settings." I've already got macros enabled and I'm the author so I'm not sure what the problem is. There is only one module and all of the macros function properly. Any ideas about what might be causing this mildly irritating message?
Maybe if you post the vba and xml you are using?
ASKER
Ah yes! Below is the VBA code...There are 5 macros that all follow this format (only difference is whick border the formatting is applied to).
Sub DoubleUnderline(control As IRibbonControl)
Dim iRow As Integer
Dim iCol As Integer
Dim iBorder As Integer
Dim otbl As Table
On Error Resume Next
Set otbl = ActiveWindow.Selection.Sha peRange(1) .Table
For iRow = 1 To otbl.Rows.Count
For iCol = 1 To otbl.Columns.Count
If otbl.Cell(iRow, iCol).Selected Then
For iBorder = 3 To 3
otbl.Cell(iRow, iCol).Borders(iBorder).Vis ible = msoTrue
With otbl.Cell(iRow, iCol).Borders(iBorder)
.Weight = 3
.ForeColor.RGB = vbBlack
.Style = msoLineThinThin
.Visible = True
End With
Next iBorder
End If
Next iCol
Next iRow
End Sub
Here'e the XML...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="MyCustomTab" label="Table Borders" insertAfterMso="TabHome" >
<group id="customGroup1" label="Table Borders">
<button id="customButton1" label="No Border" onAction="NoBorder" imageMso="BorderNone" />
<button id="customButton2" label="1Bottom" onAction="SingleUnderline" imageMso="BorderBottom" />
<button id="customButton3" label="2Bottom" onAction="DoubleUnderline" imageMso="DoubleBottomBord er" />
<separator id="MySeparator1" />
<button id="customButton4" label="1Top1Bottom" onAction="SingleSingle" imageMso="BorderTopAndBott om" />
<button id="customButton5" label="1Top2Bottom" onAction="SingleDouble" imageMso="BorderTopAndDoub leBottom" />
<button id="customButton6" label="2Top2Bottom" onAction="DoubleDouble" imageMso="UnderlineDouble" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Sub DoubleUnderline(control As IRibbonControl)
Dim iRow As Integer
Dim iCol As Integer
Dim iBorder As Integer
Dim otbl As Table
On Error Resume Next
Set otbl = ActiveWindow.Selection.Sha
For iRow = 1 To otbl.Rows.Count
For iCol = 1 To otbl.Columns.Count
If otbl.Cell(iRow, iCol).Selected Then
For iBorder = 3 To 3
otbl.Cell(iRow, iCol).Borders(iBorder).Vis
With otbl.Cell(iRow, iCol).Borders(iBorder)
.Weight = 3
.ForeColor.RGB = vbBlack
.Style = msoLineThinThin
.Visible = True
End With
Next iBorder
End If
Next iCol
Next iRow
End Sub
Here'e the XML...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="MyCustomTab" label="Table Borders" insertAfterMso="TabHome" >
<group id="customGroup1" label="Table Borders">
<button id="customButton1" label="No Border" onAction="NoBorder" imageMso="BorderNone" />
<button id="customButton2" label="1Bottom" onAction="SingleUnderline"
<button id="customButton3" label="2Bottom" onAction="DoubleUnderline"
<separator id="MySeparator1" />
<button id="customButton4" label="1Top1Bottom" onAction="SingleSingle" imageMso="BorderTopAndBott
<button id="customButton5" label="1Top2Bottom" onAction="SingleDouble" imageMso="BorderTopAndDoub
<button id="customButton6" label="2Top2Bottom" onAction="DoubleDouble" imageMso="UnderlineDouble"
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Hi
It worked for me (nice vba - I think I recognise it)
I did get the warning but thats becasue I don't have 5 of the six macros. The one I have did work from the new tab.
Are you sure all of the six are there and have the exact names as in the xml (case IS important.)
Minor point - if you are only setting one border you don''t need the iBorder /For Next Loop
It worked for me (nice vba - I think I recognise it)
I did get the warning but thats becasue I don't have 5 of the six macros. The one I have did work from the new tab.
Are you sure all of the six are there and have the exact names as in the xml (case IS important.)
Minor point - if you are only setting one border you don''t need the iBorder /For Next Loop
For iRow = 1 To otbl.Rows.Count
For iCol = 1 To otbl.Columns.Count
If otbl.Cell(iRow, iCol).Selected Then
With otbl.Cell(iRow, iCol).Borders(3)
.Visible = msoTrue
.Weight = 3
.ForeColor.RGB = vbBlack
.Style = msoLineThinThin
.Visible = True
End With
End If
Next iCol
Next iRow
ASKER
Hi and thanks for your help. Based on your comment about getting the error message, I went in to the xml and deleted out all of the button lines except the double underline (updated the button # to 1). Then I deleted all of the Subs except the double underline sub. Saved, replaced files as necessary and opened it again. names match, btw.
Yikes! I still get the error. Does the same thing happen to you? I've used this same xml code for an excel ribbon customization and don't have this issue. So, I'm wondering if something in my _rels might be the problem (code provided below).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" /><Relatio nship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail" Target="docProps/thumbnail .jpeg"/><R elationshi p Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.x ml"/><Rela tionship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/ ><Relation ship Id="customUIRelID" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/customUI. xml" /></Relationships>
Other than that, I'm at a loss...
Yikes! I still get the error. Does the same thing happen to you? I've used this same xml code for an excel ribbon customization and don't have this issue. So, I'm wondering if something in my _rels might be the problem (code provided below).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"
Other than that, I'm at a loss...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Most excellent! Thank you very much!!! Out of curiosity, was it the
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
or the onLoad command?
And why?
Again, I thank you most effusively!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
or the onLoad command?
And why?
Again, I thank you most effusively!