iam_david_lee
asked on
Help with converting VB EXE to VB DLL - automating Powerpoint.
Hi
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.
Thank you.
__________________________ __________ __________ __________
Sub InsertImage()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppShape As PowerPoint.Shape
Dim ppCurrentSlide As PowerPoint.Slide
Set ppApp = CreateObject("PowerPoint.A pplication ")
ppApp.Visible = True
Set ppPres = ppApp.Presentations.Add(ms oTrue)
Set ppCurrentSlide = ppPres.Slides.Add(Index:=1 , Layout:=ppLayoutBlank)
ppPres.ApplyTemplate ("C:\cfdeals.ppt")
With ppCurrentSlide.Shapes
' 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
End With
ppPres.SaveAs "C:\hello.ppt"
ppApp.Quit
End Sub
__________________________ __________ __________ __________ _
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.
Thank you.
__________________________
Sub InsertImage()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppShape As PowerPoint.Shape
Dim ppCurrentSlide As PowerPoint.Slide
Set ppApp = CreateObject("PowerPoint.A
ppApp.Visible = True
Set ppPres = ppApp.Presentations.Add(ms
Set ppCurrentSlide = ppPres.Slides.Add(Index:=1
ppPres.ApplyTemplate ("C:\cfdeals.ppt")
With ppCurrentSlide.Shapes
' Adds a picture to slide 1 in the active presentation.
Set oPicture = .AddPicture("C:\image1.jpg
' Now scale the image
oPicture.ScaleHeight 1, msoTrue
oPicture.ScaleWidth 1, msoTrue
End With
ppPres.SaveAs "C:\hello.ppt"
ppApp.Quit
End Sub
__________________________
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Give the IUSR internet acount access to the folder you are trying to write in. I think its a security issue.
ASKER
Thanks. Got it working now...
ASKER
Thanks aelatik. I used your solution but I am getting the following error message.
Microsoft PowerPoint 2002 error '80004005'
Presentation.SaveAs : An error occurred while PowerPoint was saving the file.
I couldn't find much info on this error online....Any ideas....
Thankx.