![]() |
#1
|
|||
|
|||
![]()
Hi guys,
I worked at some Word documents, that had a custom tab with a button that inserted 10 specified building blocks, that are images, to a table in the document. Here is the macro for one of them. Sub ApplyOpenCommunicatie(control As IRibbonControl) ' ' ApplyOpenCommunicatie Macro ' ' With ActiveDocument Dim oBB As BuildingBlock Dim oRng As Range Dim oField As Field Dim oSection As Section Dim oHeader As HeaderFooter Dim oFooter As HeaderFooter Set oRng = ActiveDocument.Tables(1).Rows(2).Cells(2).Range oRng.End = oRng.End - 1 'to exclude the end of cell marker Set oBB = ActiveDocument.AttachedTemplate.BuildingBlockEntri es("Public") oBB.Insert Where:=oRng, RichText:=True For Each oSection In ActiveDocument.Sections For Each oFooter In oSection.Footers If oFooter.Exists Then For Each oField In oFooter.Range.Fields oField.Update Next oField End If Next oFooter Next oSection End With End Sub Now I'm looking for a way to do the same in Powerpoint. I thought about working with the Image ActiveX Element, but I don't know if I can choose between 10 different images. Does anybody have an idea what the best way would be to make the user first choose between 10 images. And when he has choosen, that the image appaers in the next footers? Thanks a lot!! I'm really stuck! |
#2
|
|||
|
|||
![]()
PowerPoint doesn't support Building Blocks at all (sadly)
|
#3
|
|||
|
|||
![]()
So I kinda found a vba code that worked ok for my problem:
Sub ApplyOpenCommunicatie(Control As IRibbonControl) Dim objPresentaion As Presentation Dim objSlide As Slide Dim objImageBox As Shape Set objPresentaion = ActivePresentation Set objSlide = objPresentaion.Slides.Item(2) Set objImageBox = objSlide.Shapes.AddPicture(FileName:=ActivePresent ation.Path & "\Public.bmp", LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=500, Top:=100, Width:=150, Height:=50) End Sub But this only works when I'm working on it as the macro enabled template. When I open it from the folder to work in the document as a normal user, it says this: The macro cannot be found or has been disabled because of your security settings And now it even says while I haven't changed a thing: specified file not found Can anybody help me with what I'm doing wrong?? Thanks!! |
#4
|
|||
|
|||
![]()
You are not doing anything wrong - Macro enabled templates are as much use as a chocolate fire guard. The ribbon button (or a QAT entry) will point at the macro IN the template but NOT at macros in presentations made with the template! And yes this is a really badly thought out implantation!
Create a ppam AddIn from your file with a ribbon entry programmed in XML. Last edited by JohnWilson; 08-03-2017 at 07:54 AM. |
![]() |
Tags |
building blocks, insert graphic, xml |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks | jc491 | Word VBA | 7 | 01-03-2016 10:34 PM |
Sharing Building Blocks | dricciuti | Word | 0 | 11-03-2013 03:40 PM |
Building blocks show correctly in dropdown, but wrong building block populates in doc | wordgirl123 | Word | 0 | 10-03-2013 08:30 AM |
![]() |
namedujour | Word | 5 | 05-03-2011 01:37 PM |
Building Blocks in Outlook | namedujour | Outlook | 2 | 04-06-2011 06:29 AM |