• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copying files from folder and embedding it in Powerpoint slide

astha_22

New Member
Hi,

In a folder there are some files which I want to copy and embed it in my powerpoint slide.
I have written a code, however it is giving error "Run Time Error . Shapes unknown member: Invalid Request on this line: Set obchart = pres.Shapes.AddOLEObject(100, 100, 200, 100, folderpath & fil.Name, True)

Sub copyfilestoppt()

Dim fso As Scripting.FileSystemObject
Dim fil As Scripting.File
Dim foldername As Scripting.Folder
Dim folderpath As String
Dim pres As PowerPoint.Slide
Dim obchart As Object


folderpath = "C:\Users\av\Desktop\Macro\Excel maacro"

Set fso = New Scripting.FileSystemObject

Set foldername = fso.GetFolder(folderpath)


Set pres = ActivePresentation.Slides(1)

'loop
For Each fil In foldername.Files

With ActivePresentation
Set pres = ActivePresentation.Slides(1)
Set obchart = pres.Shapes.AddOLEObject(100, 100, 200, 100, folderpath & fil.Name, True)

End With
Next fil

Set obchart = Nothing

End Sub
 

Hi !

If you are in a hurry, as here it is an Excel forum …
… better is to ask your question in a PowerPoint forum !
 
Please guide me where is powerpoint forum, request to please let me the error in my code. Appreciate your support
 
Back
Top