Hi All,
I'm attempting to write macro to that will include programming to import all photos (jpegs in this instance) that are in the same folder that presentation that includes the macro is stored and place each photo on a new slide. I'm currently stuch at the photo import portion and was wondering if anyone could hep me out. Here is what I have so far:
Option Explicit
Sub PresentationFormat()
' Description: This macro is designed to apply a standard size and center position to all
' existing pictures and a uniform Title across all slides
' Next steps are to add syntax to insert all pictures from same folder, one on each slide
' Changes----------------------------------------------
' Date: Programmer: Contact Info: Change:
'
'
' =======================================================
On Error GoTo ErrorHandler
Dim oSld As Slide
Dim oShp As Shape
Dim x As Integer
Dim y As Integer
Dim strTitle As String
Dim filepath As String
ActiveWindow.View.GotoSlide 1 ' Change slide index position to the first slide
filepath = ActivePresentation.Path & "\*.jpg" ' gets same filepath as presentation
With ActivePresentation.PageSetup ' sets x and y parameters
x = .SlideWidth / 2
y = .SlideHeight / 2
End With
strTitle = InputBox("Please Enter A New Title") ' user enters title
For Each oSld In ActivePresentation.Slides
oSld.Shapes.Title.TextFrame.TextRange.Text = strTitle ' applies users title across all slides
For Each oShp In oSld.Shapes ' all pictures in all slides
If oShp.Type = msoPicture Then
oShp.LockAspectRatio = False ' allows resizing
oShp.Height = 329.76 ' set in pixels
oShp.Width = 473.76 ' set in pixels
oShp.Left = x - (oShp.Width / 2) ' centers horizontaly
oShp.Top = y - (oShp.Height / 2) ' centers vertically
oShp.Shadow.Visible = msoTrue ' shadow border
End If
Next
Next
NormalExit:
Exit Sub
ErrorHandler:
MsgBox ("Oops, there's an error. Please call me!")
Resume NormalExit:
End Sub
Any help would be greatly appreciated, thanks!
Bookmarks