Help with converting VB EXE to VB DLL - automating Powerpoint.
Posted on 2004-10-19
I need create a DLL componenet which will be called by an ASP page. The ASP page will call/create the DLL component and pass a list of image names with path info(comma seperated). The DLL will automatically create a Powerpoint presentation and insert the images into it and save the presentation.
I have got the following bit of code working as an EXE app. It does not take any parameters in though. When I create a DLL in Visual Studio and use the same code it compiles but hangs on running.
I would very much appreciate if anyone can help me convert the code to work as DLL and show me how to pass the image names from ASP into VB DLL.
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppShape As PowerPoint.Shape
Dim ppCurrentSlide As PowerPoint.Slide
Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = True
Set ppPres = ppApp.Presentations.Add(msoTrue)
Set ppCurrentSlide = ppPres.Slides.Add(Index:=1, Layout:=ppLayoutBlank)
' Adds a picture to slide 1 in the active presentation.
Set oPicture = .AddPicture("C:\image1.jpg", msoFalse, msoTrue, 92, 132, 1, 1)
' Now scale the image
oPicture.ScaleHeight 1, msoTrue
oPicture.ScaleWidth 1, msoTrue