Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #19  
Old 01-17-2015, 12:11 PM
JohnWilson JohnWilson is offline Need to import a bunch of .png files from a folder Windows 7 64bit Need to import a bunch of .png files from a folder Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

I didn't understand what you meant!

Try

Sub ImportABunch()
' based on code from pptfaq

Dim SW As Long
Dim SH As Long
Dim strTemp As String
Dim strPath As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
Dim iCount As Integer
Dim lngStart As Long
On Error GoTo err
'++++++++++++++++++++++++++++++NEW
If ActivePresentation.Slides.Count > 1 Then _
ActivePresentation.Slides(2).Shapes.Range.Copy
'++++++++++++++++++++++++++++++NEW
' Edit these to suit:
strPath = "c:\Users\John\Desktop\Pics\"
strFileSpec = "*.png"
SH = ActivePresentation.PageSetup.SlideHeight
SW = ActivePresentation.PageSetup.SlideWidth
strTemp = Dir(strPath & strFileSpec)
lngStart = ActiveWindow.Selection.SlideRange(1).SlideIndex
Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add _
(lngStart + 1, ppLayoutBlank)
lngStart = lngStart + 1
iCount = iCount + 1
Set oPic = oSld.Shapes.AddPicture(FileName:=strPath & strTemp, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, _
Top:=0, _
Width:=msoTrue, _
Height:=msoTrue)

'reset height to a 150points less than slide height
With oPic
.LockAspectRatio = msoTrue
.Height = SH - 150
.Left = (SW - oPic.Width) / 2
.Top = 100
End With
' Get the next file that meets the spec and go round again

'=========================NEW
oSld.Shapes.Paste
'=========================NEW
strTemp = Dir
Loop
If MsgBox("I added " & iCount & " Images." & vbCrLf & "Would you like to delete the files? This cannot be reversed.", vbYesNo) = vbYes Then
Kill strPath & "*png"""
End If
Exit Sub
err:
MsgBox "There's an error"
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to import a bunch of .png files from a folder macro, data import from the ONLY text file in current folder ue418 Excel Programming 5 10-28-2017 12:52 PM
Import from .CUB files in MS Access vamsikrishnad Office 0 12-30-2014 03:19 AM
Import msg-files to Outlook Jeff10 Outlook 0 01-19-2013 10:56 AM
Need to import a bunch of .png files from a folder Import Multiple XML Files TallKewlOnez Excel Programming 1 04-09-2012 05:19 PM
How might I group a bunch of text boxes without getting a space around the edge? Augusta PowerPoint 0 08-25-2011 01:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:49 PM.


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