PDA

View Full Version : Solved: VBA insert and position 2 emfs per slide



owen_1987
12-12-2011, 04:07 AM
Hi all,

Please could someone help me with this?

I have multiple slides with 2 emfs (pictures) on them. On the first slide I have one emf with a filename "0001.emf" and one with a filename "0101.emf". That pattern continues on the 2nd slide (filenames "0002.emf" and "0102.emf"), 3rd slide (filenames "0003.emf" and "0103.emf") etc etc.

What I am looking to do is justify one to the right ("0001.emf") and one to the left ("0101.emf") using a "next i" command.

I have this as a base, which resizes and positions a single emf picture on a single slide (that someone on here kindly helped me with in the past)

Sub ResizeAndPosition_Charts()
Dim i As Integer
Dim osld As Slide
Dim opic As ShapeRange
For Each osld In ActivePresentation.Slides
For i = 1 To osld.Shapes.Count
'EMF - finds all objects with "EMF" in the Alt Text
If UCase(Right(osld.Shapes(i).AlternativeText, 3)) = "EMF" Then
Set opic = osld.Shapes.Range(i)
opic.LockAspectRatio = True
opic.Height = 320 'change to suit
End If
Next i
Next osld
End Sub

Thanks for any help in advance

owen_1987
12-12-2011, 10:01 AM
Sorted it - changed the alt text name and used that to identify the same objects (emf) as different things

John Wilson
12-12-2011, 10:20 AM
Glad you sorted it. For future reference the Alt Text trick no longer works in version 2010.