Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images in ppt file

Status
Not open for further replies.

ferdo

Mechanical
Jul 4, 2002
2,837
RO

Hi,

Maybe this will be useful for somebody. Lets suppose that you have a lot of images files (CATDrawings saved as jpg files for example) and you want to create a Microsoft presentation file. A quick way to create the ppt file is to use next macro in a blank presentation, with a blank landscape slide at start. Just create a folder named CATIA on C drive where you will put your image files (modify the macro if you have something else then jpg files or if you want to use another path) and copy-paste in VB editor in a new module what is written in the next rows. Be aware that the width and height of the slide is A0. After running the macro, you can open the My file.ppt saved in the same path (c:\CATIA\).



Sub INSERT()
'
' Macro by Ferdo
'


Set fs = Application.FileSearch

With fs

.LookIn = "c:\CATIA\"
.FileName = "*.JPG"

If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderDescending) > 0 Then

For i = 1 To .FoundFiles.Count



ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutBlank).SlideIndex

ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=.FoundFiles(i), LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=1189, Height:=841).Select



Next

End If

End With

ActiveWindow.View.Zoom = 60

ActivePresentation.SaveAs FileName:="c:\CATIA\My file.ppt"

ActiveWindow.Close

End Sub

Regards
Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top