Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2013, 08:55 AM
c2turbo c2turbo is offline PowerPoint 2007 Macro Help Windows XP PowerPoint 2007 Macro Help Office 2007
Novice
PowerPoint 2007 Macro Help
 
Join Date: Sep 2013
Posts: 2
c2turbo is on a distinguished road
Default PowerPoint 2007 Macro Help

I wanted to know if there was a way to create two new macros for PowerPoint. At past firms I have worked at, PowerPoint had two very useful macros which could literally save hours over the course of a week.



The first was when pasting a new image (an updated data table from excel for example), you could place the new image over the bottom right corner of the old image. From there you would select both images using ctrl and then click the macro that would resize the new image to the exact measurements of the old image.

The second macro was a swap macro. So once you had the new image matched to the same size of the old image, you would then select both images again and press the swap macro which would literally swap the position the two images were in. This would allow you to place the update image in the spot of the outdated image without having to spend any time re-aligning the new image.

Please let me know if anyone knows how to create these two macros.
Reply With Quote
  #2  
Old 09-18-2013, 12:42 AM
JohnWilson JohnWilson is offline PowerPoint 2007 Macro Help Windows 7 64bit PowerPoint 2007 Macro Help Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

See if this works Select first the original shape and then the new shape with ctrl and run

Sub SizeAndSwap()
Dim oTarget As Shape
Dim oSource As Shape
Dim sngL As Single
Dim sngT As Single
On Error Resume Next
If ActiveWindow.Selection.ShapeRange.Count = 2 Then
On Error GoTo err
Set oSource = ActiveWindow.Selection.ShapeRange(1)
Set oTarget = ActiveWindow.Selection.ShapeRange(2)
oTarget.Width = oSource.Width
oTarget.Height = oSource.Height
sngL = oTarget.Left
sngT = oTarget.Top
oTarget.Left = oSource.Left
oTarget.Top = oSource.Top
oSource.Left = sngL
oSource.Top = sngT
If MsgBox("Delete original?", vbInformation + vbYesNo) = vbYes Then oSource.Delete
Else
MsgBox "You need to select TWO shapes", vbCritical
End If
Exit Sub
err:
MsgBox "No shapes are selected.", vbCritical
End Sub

Ideally it would need a button permanently on the ribbon to run it and some more error checking. We could do this for you but it would have to go through the books and there would be a small charge.
johnATpptalchemy.co.uk
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials

Last edited by JohnWilson; 09-18-2013 at 02:15 AM.
Reply With Quote
  #3  
Old 09-18-2013, 01:13 PM
c2turbo c2turbo is offline PowerPoint 2007 Macro Help Windows XP PowerPoint 2007 Macro Help Office 2007
Novice
PowerPoint 2007 Macro Help
 
Join Date: Sep 2013
Posts: 2
c2turbo is on a distinguished road
Default

That's a great start. Sizing and placement are off but it does replace the old image.
Reply With Quote
  #4  
Old 09-19-2013, 12:23 AM
JohnWilson JohnWilson is offline PowerPoint 2007 Macro Help Windows 7 64bit PowerPoint 2007 Macro Help Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Sizing can only be "OFF" if the aspect ratio of the new image is different from that of the original. By default changing the width and height of images does not change the aspect ration.

You can enable this (and cause some distortion) by setting LockAspectRatio to off

Set oSource = ActiveWindow.Selection.ShapeRange(1)
Set oTarget = ActiveWindow.Selection.ShapeRange(2)
oTarget.LockAspectRatio = False
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply

Tags
macro, powerpoint 2007



Similar Threads
Thread Thread Starter Forum Replies Last Post
PowerPoint 2007 Macro Help Macro for Copying Charts to Powerpoint bremen22 Excel Programming 1 10-01-2013 03:27 PM
PowerPoint 2007 Macro Help Macro to link to another powerpoint presentation slothman2000 PowerPoint 15 09-22-2012 04:42 AM
PowerPoint 2007 Macro Help PowerPoint 2007: my macro takes a loooooong time to proceed BBBenj PowerPoint 3 04-01-2012 12:08 PM
Powerpoint Macro To Insert Objects Sample lahuva PowerPoint 0 07-06-2011 10:51 AM
PowerPoint 2007 --> PowerPoint 2003 Webpage? josephsh PowerPoint 0 06-09-2011 11:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:55 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