Log in

View Full Version : On double click re size image to size of slide



ADAMC
11-18-2013, 06:45 AM
Hi all - First time poster.

Many thanks for any replies.

I have a lot of images in PowerPoint most of which need to be re sized and at the moment Im doing this manually...

Is there a way in VBA I can say:

"If I double click on an image re size that image to fit the current slide size".

I am using PP 2010.

There is only ever 1 image per slide if i coudl double click an image and it auto fitted to the slide size that would be a great time saver but Im not sure if this is even possible can anyone help or give me a kick in the right direction?

Thanks everyone.

John Wilson
11-18-2013, 06:49 AM
There's no simple way to make a double click do that. You could write an AddIn that adds a size to full slide on the ribbon or if you are a good coder add a right click option.

ADAMC
11-18-2013, 06:55 AM
Thanks for the reply John - I actually have no coding skills what so ever in PowerPoint. But have some basic excel knowledge. I like the idea of an Add-in? Even a short cut key as oppose to a double click would be useful to me, Is assigning a short cut key a possibility?

ADAMC
11-18-2013, 07:02 AM
Just had a quick scan through the link in your Bio and I've actually found a Macro which is just what I need and seems to work for me.


Sub Pic_Size()
'resize selection to full page
'note may distort image
Dim oshp As Shape
If ActiveWindow.Selection.Type <> ppSelectionShapes Then Exit Sub
Set oshp = ActiveWindow.Selection.ShapeRange(1)
With oshp
.LockAspectRatio = False
.Height = ActivePresentation.PageSetup.SlideHeight
.Width = ActivePresentation.PageSetup.SlideWidth
.Left = 0
.Top = 0
End With
End Sub


If I can assign a short cut key to this, this would be exactly what I needed. :) Thanks

John Wilson
11-18-2013, 07:09 AM
OK. As it happens we already have in house code for this.

Download the pptm file here (http://www.pptalchemy.co.uk/Downloads/right.pptm). You can check out the function by right clicking the image and seeing the new entry in the menu. There is hidden XML code as well as the vba you can see.

To make it into an AddIn if it's what you need.

Save As but choose type= *.ppam AddIn

Save in the default folder that opens.

If you do not have the DEVELOPER Tab visible enable from File > Options > Customise Ribbon ansd tick DEVELOPER in the Right pane

Now choose DeVELOPER > AddIns and Add New > Choose Right.ppam

All done

Oh you cannot create shortcut keys in PPT and NO you can't borrow Antonia!

The code in the link will distort images the code here won't.

ADAMC
11-18-2013, 07:27 AM
John, many thanks for this looks great I understand your instructions but I have a problem (It might not be related to the macro could just be me)

When I save as a PPAM straight away I get PowerPoint is not responding and eventually crashes :(

Anyway I've tested this on a colleagues machine and it works great.

Many thanks for taking the time to reply

John Wilson
11-18-2013, 07:33 AM
Do you have Kaspersky virus checker??

If so that's the problem.

martynjoey
12-03-2013, 11:44 PM
That's good i appreciate your information.