473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

vb.net dll won't release powerpoint

Hi,

I am writing some VB.NET code that compiles to a dll. There is some
code within it that manipulates Powerpoint 2003.

The dll I am writing is for smart tags, and I am having trouble because
sometimes Powerpoint is remaining running (powerpnt.exe in Task
Manager). One action of my smart tags calls InsertChart (code below).
The designated line causes powerpoint to remain running even after the
user has manually closed the program--when that line is commented out,
powerpoint exits successfully.

Some quick testing I have done indicates that when my code changes the
active presentation (and would require a save), powerpoint doesn't exit.
If I don't actually change the presentation, it exits fine. (I
replaced the troublesome line below with one that changed the text of a
text box and had the same problem.)

If anyone has some insight into what's going on and how I need to
properly release my references to Powerpoint, I would be most
appreciative!

Thanks!

-Casey

'target is of type Powerpoint.TextRange
Public Sub InsertChart(ByVal target As Object, ByVal imagePath As
String) Implements IOfficeInteract.InsertChart
Dim pptApp As PowerPoint.Application
Dim rng As PowerPoint.TextRange
Dim shp As PowerPoint.Shape

Try
'try to grab powerpoint from target
rng = DirectCast(target, PowerPoint.TextRange)
pptApp = rng.Application
*****THE FOLLOWING LINE CAUSES THE PROBLEM. WHEN IT ISN'T COMMENTED,
POWERPOINT REMAINS RUNNING, WHEN IT IS COMMENTED, POWERPOINT CLOSES
SUCCESSFULLY ********
'shp =
pptApp.ActiveWindow.Selection.SlideRange.Shapes.Ad dPicture(imagePath, _
' Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoTrue, _
' 0, 0, 100, 100)

**********************

Catch ex As Exception
MsgBox("PPT:Error inserting chart:" & ex.Message)
End Try

'clean up is important so that references aren't left in memory
Try
If Not pptApp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComO bject(pptApp)
End If
If Not rng Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComO bject(rng)
End If
If Not shp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComO bject(shp)
End If
If Not target Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComO bject(target)
End If

Catch ex As Exception
'just eat it at this point
MsgBox("PPT Clean UP ERror: " & ex.Message)
End Try
End Sub
Nov 21 '05 #1
0 1188

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the...
6
by: C Williams | last post by:
Hi, I am writing some VB.NET code that compiles to a dll. There is some code within it that manipulates Powerpoint 2003. The dll I am writing is for smart tags, and I am having trouble...
2
by: WillRead | last post by:
I have a VB.Net application and a PowerPoint presentation explaining how each form in the application works, etc.. I would like to select and display the slide appropriate for each form by pressing...
7
by: Colleyville Alan | last post by:
I have an app that uses Access to grab various PowerPoint slides using the followhyperlink command. I have set the PPT window to run in a minimized state: FollowHyperlink link Set oPres =...
4
by: Joseph | last post by:
I am trying to open a 3 powerpoint presentation simultaneously afte each other without interruption, the operator of the application doe not need to notice anything or interfere in the operation of...
0
by: Marc Eggenberger | last post by:
Hi there. I have an webapp (asp.net) which should use powerpoint to create a presentation and then send that presentation to the user. I'm using VS2003 and Office2003 (project req.). The...
8
by: Rut | last post by:
Does anyone know how to start powerpoint from vb.net without the ppt screen appearing. I want to keep it hidden? Using this code: Try pp = New PowerPoint.Application pp.Visible =...
1
by: chrizstone | last post by:
Hi Guys, What i want to do is: I want to create a Slide programmatically where a Table is on it! Here´s my Code: String strTemplate; strTemplate = template; String...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.