Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2017, 01:01 AM
lodi123 lodi123 is offline Looking for a way to implement building blocks Windows 7 32bit Looking for a way to implement building blocks Office 2010 32bit
Novice
Looking for a way to implement building blocks
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default Looking for a way to implement building blocks

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!
Reply With Quote
  #2  
Old 08-01-2017, 03:36 AM
JohnWilson JohnWilson is offline Looking for a way to implement building blocks Windows 7 64bit Looking for a way to implement building blocks Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

PowerPoint doesn't support Building Blocks at all (sadly)
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 08-01-2017, 11:43 PM
lodi123 lodi123 is offline Looking for a way to implement building blocks Windows 7 32bit Looking for a way to implement building blocks Office 2010 32bit
Novice
Looking for a way to implement building blocks
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default

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!!
Reply With Quote
  #4  
Old 08-03-2017, 04:33 AM
JohnWilson JohnWilson is offline Looking for a way to implement building blocks Windows 7 64bit Looking for a way to implement building blocks Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

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.
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials

Last edited by JohnWilson; 08-03-2017 at 07:54 AM.
Reply With Quote
Reply

Tags
building blocks, insert graphic, xml



Similar Threads
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
Building Blocks - WHY??? namedujour Word 5 05-03-2011 01:37 PM
Looking for a way to implement building blocks Building Blocks in Outlook namedujour Outlook 2 04-06-2011 06:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft