473,434 Members | 1,738 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,434 software developers and data experts.

Office application object problem

Hi all,

I'am trying to create object of Excel and powerpoint through my VB.Net
2005 application. When user close the excel or powerpoint it's instance

remains in the task manager.
I used ReleaseComObject because of which excel instance now goes trough
task manager , but same dosen't work with the Powerpoint object.
Any solution?
- Thanks
-Sajin

Oct 4 '06 #1
5 1539

"sajin" <sa***@iprlab.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi all,

I'am trying to create object of Excel and powerpoint through my VB.Net
2005 application. When user close the excel or powerpoint it's instance

remains in the task manager.
I used ReleaseComObject because of which excel instance now goes trough
task manager , but same dosen't work with the Powerpoint object.
Any solution?
- Thanks
-Sajin
A simple test would be to create a new project, create two simple objects -
one Powerpoint instance, one Excel instance, release them and see if they
still hang around. I think that probably they will dissapear from Task
Manager. I suspect you have a reference to an instance of an object
returned from Powerpoint still loitering in your run somewhere. Are you
calling any methods on the office objects that return objects (like fields,
or selections or suchlike)? Those are reference counted and also need to be
released, not just the application instances.

Robin
Oct 4 '06 #2
Hi,
After doing ReleaseCom also still the instance exists in the task
manager , this is the code i am using
************************************************** *********************************
Dim filepath As String

If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK
Then
filepath = OpenFileDialog1.FileName
End If

PowerApp = New PowerPoint.Application

PowerApp.Visible = Office.MsoTriState.msoCTrue

PowerApp.Presentations.Open(filepath,
Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse,
Office.MsoTriState.msoTrue)

PowerApp.ActiveWindow.View.GotoSlide(index:=PowerA pp.ActivePresentation.Slides.Add(index:=1,
Layout:=PowerPoint.PpSlideLayout.ppLayoutTitle).Sl ideIndex)
' only close PowerPoint if there are no open Presentations
If (PowerApp.Presentations.Count <= 0) Then
PowerApp.Quit()
End If

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

Robinson wrote:
"sajin" <sa***@iprlab.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi all,

I'am trying to create object of Excel and powerpoint through my VB.Net
2005 application. When user close the excel or powerpoint it's instance

remains in the task manager.
I used ReleaseComObject because of which excel instance now goes trough
task manager , but same dosen't work with the Powerpoint object.
Any solution?
- Thanks
-Sajin

A simple test would be to create a new project, create two simple objects -
one Powerpoint instance, one Excel instance, release them and see if they
still hang around. I think that probably they will dissapear from Task
Manager. I suspect you have a reference to an instance of an object
returned from Powerpoint still loitering in your run somewhere. Are you
calling any methods on the office objects that return objects (like fields,
or selections or suchlike)? Those are reference counted and also need to be
released, not just the application instances.

Robin
Oct 4 '06 #3
Hi,
After doing ReleaseCom also still the instance exists in the task
manager , this is the code i am using
************************************************** *********************************
Dim filepath As String

If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK
Then
filepath = OpenFileDialog1.FileName
End If

PowerApp = New PowerPoint.Application

PowerApp.Visible = Office.MsoTriState.msoCTrue

PowerApp.Presentations.Open(filepath,
Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse,
Office.MsoTriState.msoTrue)

PowerApp.ActiveWindow.View.GotoSlide(index:=PowerA pp.ActivePresentation.Slides.Add(index:=1,
Layout:=PowerPoint.PpSlideLayout.ppLayoutTitle).Sl ideIndex)
' only close PowerPoint if there are no open Presentations
If (PowerApp.Presentations.Count <= 0) Then
PowerApp.Quit()
End If

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

Robinson wrote:
"sajin" <sa***@iprlab.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi all,

I'am trying to create object of Excel and powerpoint through my VB.Net
2005 application. When user close the excel or powerpoint it's instance

remains in the task manager.
I used ReleaseComObject because of which excel instance now goes trough
task manager , but same dosen't work with the Powerpoint object.
Any solution?
- Thanks
-Sajin

A simple test would be to create a new project, create two simple objects -
one Powerpoint instance, one Excel instance, release them and see if they
still hang around. I think that probably they will dissapear from Task
Manager. I suspect you have a reference to an instance of an object
returned from Powerpoint still loitering in your run somewhere. Are you
calling any methods on the office objects that return objects (like fields,
or selections or suchlike)? Those are reference counted and also need to be
released, not just the application instances.

Robin
Oct 4 '06 #4
>
PowerApp.ActiveWindow.View.GotoSlide(index:=PowerA pp.ActivePresentation.Slides.Add(index:=1,
Layout:=PowerPoint.PpSlideLayout.ppLayoutTitle).Sl ideIndex)
' only close PowerPoint if there are no open Presentations
If (PowerApp.Presentations.Count <= 0) Then
PowerApp.Quit()
End If
Don't quote me but I think possibly PowerApp.ActivePresentation.Slides is a
reference. Try fetching the reference (PowerApp.ActivePresentation.Slides)
into a variable and then issuing the Add in a new statement, then releasing
the variable you allocated for the Slides collection. Also be aware if Add
returns a reference (I don't think it does, but just in case). You should
be very wary of compound statements like this when using interop, because
sometime references are created that you don't see very easily.


Oct 4 '06 #5
Hi when I use a word object I always "dispose" of it like this and then
nothing remains in the taskmanager

'open word class
Dim oWord As New Word.ApplicationClass

'open a document
Dim oDoc As Word.Document

'add a template to it
oDoc = oWord.Documents.Add(Application.StartupPath & "\yourfile.dot")

'do the work
....

'release eveything
oDoc.Close()
oDoc = Nothing
oWord.Quit(False)
oWord = Nothing
hope this helps,

Greetz, Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Robinson" <to******************@myinboxtoomuchtoooften.comsc hreef in
bericht news:eg*******************@news.demon.co.uk...
PowerApp.ActiveWindow.View.GotoSlide(index:=PowerA pp.ActivePresentation.Slid
es.Add(index:=1,
Layout:=PowerPoint.PpSlideLayout.ppLayoutTitle).Sl ideIndex)
' only close PowerPoint if there are no open Presentations
If (PowerApp.Presentations.Count <= 0) Then
PowerApp.Quit()
End If

Don't quote me but I think possibly PowerApp.ActivePresentation.Slides is
a
reference. Try fetching the reference
(PowerApp.ActivePresentation.Slides)
into a variable and then issuing the Add in a new statement, then
releasing
the variable you allocated for the Slides collection. Also be aware if
Add
returns a reference (I don't think it does, but just in case). You should
be very wary of compound statements like this when using interop, because
sometime references are created that you don't see very easily.


Oct 4 '06 #6

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

Similar topics

3
by: NQuinn | last post by:
I loaded an access application, which was created and runs fine on Office 2000, onto a computer with Office XP. The application creates a run-time error when running a procedure that creates a new...
13
by: Rolf | last post by:
I have Office97Pro, Office2000Premium and OfficeXP Pro all installed. I'm creating an Access97 application for another person and need to set a reference to Microsoft Office 8.0 Object Library....
4
by: Richard | last post by:
Office Addins are easy in .NET. Try this from Visual Studio's main menu: File New Project "Other Projects" Extensibility Projects Shared Addin Run the wizard and you're off...
0
by: Karel | last post by:
Hi, I have developed a vb.net application to create a mail-merged document by using Automation to word from VB.NET. I added the following reference to the application: Microsoft Office 10.0...
6
by: Marco Singer | last post by:
Hi all, is there any way to create a VB.NET application that automates MS Word and Excel and works with all Office versions from 97 and newer? I currently have Office XP installed. Ok, I could...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
0
by: Bill Fallon | last post by:
I am developing a VB.Net application with VS 2005 that opens an Excel workbook and populates the worksheet with data. I started developing the application with Office 2007 installed on my Vista...
6
by: Excel 009 | last post by:
Hi, In my office I have Office 2003 on the PC. I created an Access application which has a component reference to Microsoft Office 12.0 Object Library. The problem that I am having now it...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.