Importing and scaling images

C

Colin Wilson

Is there a way in Powerpoint to:

a. Make a picture scale automatically to the page size when importing
(i.e. not having to drag a larger image to a smaller size using the
handles), and/or

b. After inserting a picture using a "file link", changing the file link
to another file?

I'm looking for a way of inserting a large number of pictures so each
one exactly fits separate slides. The PP presentation size is normal
screen res of 1024 x 768, but the pictures are 2560 x 1924. Individually
scaling each picture is literally a "real drag"!
 
S

Steve Rindsberg

Is there a way in Powerpoint to:
a. Make a picture scale automatically to the page size when importing
(i.e. not having to drag a larger image to a smaller size using the
handles), and/or

No, but the FREE PPTools Starter Set Pick Up and Place Exactly tool

http://www.rdpslides.com/pptools/FAQ00095.htm#Pickup

will let you resize the picture to full slide size with one click.
b. After inserting a picture using a "file link", changing the file link
to another file?

There's some VBA code for this here:

Show me the link and let me edit it
http://www.rdpslides.com/pptfaq/FAQ00433.htm

There's also an inexpensive upgrade to the free starter set that includes a
kind of "shape inspector" that lets you edit shape names, links, tags and such.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
T

Troy @ TLC

In addition to the above suggestions you can use PowerTools IMPORT/EXPORT
toolset. It will allow you to mass import and size images easily (above
suggestions work perfect as well). But its Multiple Picture Importer tools
is a gem. It creates a virtual link to the original photo so you can update
images in your presentation at any time and keep all of the attributes.
You'll have to try it to really understand it...
http://corpimaging.com/PowerTools/pt-im-ex.htm

--
Best Regards,
Troy Chollar
===========================================
TLC Creative Services, Inc. >> 760-639-1853 office
www.tlccreative.com >> 760-806-1853 fax
(e-mail address removed) >> 760-521-7401 cell
===========================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
===========================================
 
J

John Langhans [MSFT]

[CRITICAL UPDATE - Anyone using Office 2003 should install the critical
update as soon as possible. From PowerPoint, choose "Help -> Check for
Updates".]
[TOP ISSUE - Are you having difficulty opening presentations in PowerPoint
that you just created (you can save, but not open)? -
http://support.microsoft.com/?id=329820]

Hello,

PowerPoint 2002 and 2003 have a Photo Album feature that does exactly this
from "Insert -> Pictures -> New Photo Album"

When, in the Photo Album dialog, you choose to insert your pictures from
"File/Disk" instead of clicking on the "Insert" button after selecting the
files you want to insert, click on the drop-menu arrow on the insert button
and choose "Link to file" instead. Then when you complete the creation of
the Photo Album presentation using it's "Fit to slide" picture layout
setting, you will get a presentation with images filling each slide and
when you replace, for example "image1.png" with a new image (overwriting it
with a new "image1.png" the next time you open the presentation the new
image will replace the previous one in the presentation as well.

If you (or anyone else reading this message) think that PowerPoint should
include additional features and options for bulk inserting of images
(without having to resort to VBA or add-ins), don't forget to send your
feedback (in YOUR OWN WORDS, please) to Microsoft at:

http://register.microsoft.com/mswish/suggestion.asp

It's VERY important that, for EACH wish, you describe in detail, WHY it is
important TO YOU that your product suggestion be implemented. A good wish
submssion includes WHAT scenario, work-flow, or end-result is blocked by
not having a specific feature, HOW MUCH time and effort ($$$) is spent
working around a specific limitation of the current product, etc. Remember
that Microsoft receives THOUSANDS of product suggestions every day and we
read each one but, in any given product development cycle, there are ONLY
sufficient resources to address the ones that are MOST IMPORTANT to our
customers so take the extra time to state your case as CLEARLY and
COMPLETELY as possible so that we can FEEL YOUR PAIN.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions).

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
D

Dennis Kuhn

I'm currently working on a similar project. My wife, a photographer,
wants to take pictures at the wedding, then download select shots from
her digital camera cards to a laptop so she can quickly import them
into a Powerpoint presentation that loops during the reception.

Most of this VBA code I got from the PowerPoint FAQ List website.
I've added a bit to fix a couple of bugs I encounted when I just
copied & pasted the code. It's hard-coded to get JPGs from a specific
directory right now, but here's what I have so far:

Sub Import_JPGs_As_Slides()

Dim strTemp As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
Dim strFN As String

' Need to add a user interface here, and ask for the path, maybe
even have
' the user browse to the appropriate folder.
' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"

strFileSpec = "C:\testpics\*.jpg"

strTemp = Dir(strFileSpec)
SlideNum = 2

Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add _
(ActivePresentation.Slides.Count + 1, ppLayoutBlank)

' Select the last slide in the presentation
' (using the count of slides as the number reference)
' This can allow for multiple folders to be imported into one
show
ActivePresentation.Slides(ActivePresentation.Slides.Count).Select

' Extract just the path before the * wildcard symbol...
strFN = ""
For i = 1 To Len(strFileSpec)
If Mid$(strFileSpec, i, 1) = "*" Then
Exit For
End If
strFN = strFN & Mid$(strFileSpec, i, 1)
Next i
' Then add the current filename to that path.
strFN = strFN & strTemp

' Add the picture to the slide
Set oPic = ActiveWindow.Selection.SlideRange.Shapes.AddPicture
_
(FileName:=strFN, _
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, _
Left:=0, Top:=0, Width:=100, Height:=100)

' Reset it to its "real" size and make it fill the slide
With oPic
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
.Height = ActivePresentation.PageSetup.SlideHeight
.Width = ActivePresentation.PageSetup.SlideWidth
End With

' Get the next file that meets the spec and go round again
strTemp = Dir
SlideNum = SlideNum + 1
Loop

End Sub



Hope this helps!

Dennis
 
S

Steve Rindsberg

Most of this VBA code I got from the PowerPoint FAQ List website.
I've added a bit to fix a couple of bugs I encounted when I just
copied & pasted the code.

If you recall the problems you ran into, I'd like to know about them, whether
it was with the code on the site or the way it was explained. I'd like to
spare others the same problems. Thanks. Here or by email at steve @ pptools
dot com is fine.

It's hard-coded to get JPGs from a specific
directory right now, but here's what I have so far:

Sub Import_JPGs_As_Slides()

Dim strTemp As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
Dim strFN As String

' Need to add a user interface here, and ask for the path, maybe
even have
' the user browse to the appropriate folder.
' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"

strFileSpec = "C:\testpics\*.jpg"

strTemp = Dir(strFileSpec)
SlideNum = 2

Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add _
(ActivePresentation.Slides.Count + 1, ppLayoutBlank)

' Select the last slide in the presentation
' (using the count of slides as the number reference)
' This can allow for multiple folders to be imported into one
show
ActivePresentation.Slides(ActivePresentation.Slides.Count).Select

' Extract just the path before the * wildcard symbol...
strFN = ""
For i = 1 To Len(strFileSpec)
If Mid$(strFileSpec, i, 1) = "*" Then
Exit For
End If
strFN = strFN & Mid$(strFileSpec, i, 1)
Next i
' Then add the current filename to that path.
strFN = strFN & strTemp

' Add the picture to the slide
Set oPic = ActiveWindow.Selection.SlideRange.Shapes.AddPicture
_
(FileName:=strFN, _
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, _
Left:=0, Top:=0, Width:=100, Height:=100)

' Reset it to its "real" size and make it fill the slide
With oPic
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
.Height = ActivePresentation.PageSetup.SlideHeight
.Width = ActivePresentation.PageSetup.SlideWidth
End With

' Get the next file that meets the spec and go round again
strTemp = Dir
SlideNum = SlideNum + 1
Loop

End Sub

Hope this helps!

Dennis

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
D

Dennis Kuhn

Steve Rindsberg said:
If you recall the problems you ran into, I'd like to know about them, whether
it was with the code on the site or the way it was explained. I'd like to
spare others the same problems. Thanks.


Cool. [grinning and handing out grains of salt, just in case]

Off the top of my head, the biggest problem was with getting the
actual file. I actually had some notes to work off of for this:

Here's the original code:

Set oPic = ActiveWindow.Selection.SlideRange.Shapes.AddPicture _
(FileName:=strFileSpec, LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, _
Left:=0, Top:=0, Width:=100, Height:=100)

This generated a run-time error: "Selection (unknown member): Invalid
request. Nothing appropriate is currently selected."

At this point, the strFileSpec variable is the path and wildcard (i.e.
"c:\testpics\*.jpg"), which I figured was too vague. So, I added code
to remove the wildcard part of the string ("*.jpg") and replace it
with the unique filename that changes with each iteration of the loop.
(See my previous post for the pertinent code. I tried to document it
well enough to be self-explanatory.)

....Looking at the code myself, I'm seeing that I'm re-stripping the
wildcard code WITHIN the loop, which is unnecessary. I shoulda put
that before the loop instead. :) Still coding, of course. I'm still
at a point where I'm trying to get each planned step to WORK. I'll
optimize later.


I also included code to place the name of the file at the bottom of
the slide. To make this easier, I added a slide number variable
(SlideNum) so I could more easily identify and add a textbox to the
correct slide. Without this variable, I was having a devil of a time
coming up with the correct syntax for "on the slide I just worked on,
darn it!" :)

'Add filename to slide in a text box
'(as wide as a slide, centered at the bottom)
Set ThisSlide = ActivePresentation.Slides(SlideNum)
Set FilenameBox = ThisSlide.Shapes.AddTextbox(msoTextOrientationHorizontal,
_
12, 502, 700, 50)

With FilenameBox
.TextFrame.TextRange.Text = strTemp
.TextFrame.TextRange.Font.Color.SchemeColor = ppForeground
.TextFrame.TextRange.Paragraphs(Start:=1, _
Length:=1).ParagraphFormat.Alignment = ppAlignCenter
.TextFrame.TextRange.Font.Name = "Courier New"
.TextFrame.TextRange.Font.Bold = True
End With


Just in case anyone's wondering: My changes to the original code from
the PPT FAQ are not copyrighted in any way. I'm posting them here so
anyone can use them. VBA is hard enough to work with in Excel or
Access... but it's been a downright pain in my butt with Powerpoint.
If I can alleviate just one person's similar pain... I've accomplished
something good.

Dennis
 
S

Steve Rindsberg

Thanks, Dennis.

I've made a few changes to the code on the FAQ based on your suggestions.
....Looking at the code myself, I'm seeing that I'm re-stripping the
wildcard code WITHIN the loop, which is unnecessary. I shoulda put
that before the loop instead. :) Still coding, of course. I'm still
at a point where I'm trying to get each planned step to WORK. I'll
optimize later.

With what's up there now, you won't have to strip off the wildcard, it gives you the
path and the filename independently now:

Batch Insert a folder full of pictures, one per slide
http://www.rdpslides.com/pptfaq/FAQ00352.htm
I also included code to place the name of the file at the bottom of
the slide. To make this easier, I added a slide number variable
(SlideNum) so I could more easily identify and add a textbox to the
correct slide. Without this variable, I was having a devil of a time
coming up with the correct syntax for "on the slide I just worked on,
darn it!" :)

The new version should help with that too:

oSld.SlideIndex or oSld.SlideNumber depending on which you're after.
Just in case anyone's wondering: My changes to the original code from
the PPT FAQ are not copyrighted in any way. I'm posting them here so
anyone can use them. VBA is hard enough to work with in Excel or
Access... but it's been a downright pain in my butt with Powerpoint.
If I can alleviate just one person's similar pain... I've accomplished
something good.

You have! Thanks!

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top