PC Review


Reply
Thread Tools Rate Thread

Automating excel from MAccess 2007

 
 
Ingman
Guest
Posts: n/a
 
      24th Sep 2008
Hi all,

I want to open and read some information from an excel worksheet from
Microsoft Access 2007. Im using early bindings and the code looks something
like this.

....
Dim xlApp as Excel.application
Dim xlWb as Excel.workbook
Dim xlWs as Excel.worksheet


Set xlapp = New Excel.application

Set xlWB = xlApp.Workbooks.Open(strFilePath)

Set xlWs = xlWb.ActiveSheet

.......

xlWb.Close
xlApp.Quit

Set xlWs = Nothing
Set xlWb = Nothing
Set xlApp = Nothing

The problem is that the Excel process continues to live on in processes, ive
read a lot about this problem and found no "automatic" solution to it. xlApp
is not = nothing, and so process continues to live on. Before i tell my
customers that they have to manually go in and kill the process threw the
task manager i just wanted to check if anyone has a solution to this problem?
Any ideas would be greatly appreciated!

//Ingman

 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      24th Sep 2008
Hi,
try to comment parts of your code between posted parts, to find out which
line cause this. also look at similar tread here with subject "Excel
instance remains open", there OP found that line Destination:=Range("A1")
caused this problem

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Ingman" <(E-Mail Removed)> wrote in message
news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> Hi all,
>
> I want to open and read some information from an excel worksheet from
> Microsoft Access 2007. Im using early bindings and the code looks
> something
> like this.
>
> ...
> Dim xlApp as Excel.application
> Dim xlWb as Excel.workbook
> Dim xlWs as Excel.worksheet
>
>
> Set xlapp = New Excel.application
>
> Set xlWB = xlApp.Workbooks.Open(strFilePath)
>
> Set xlWs = xlWb.ActiveSheet
>
> ......
>
> xlWb.Close
> xlApp.Quit
>
> Set xlWs = Nothing
> Set xlWb = Nothing
> Set xlApp = Nothing
>
> The problem is that the Excel process continues to live on in processes,
> ive
> read a lot about this problem and found no "automatic" solution to it.
> xlApp
> is not = nothing, and so process continues to live on. Before i tell my
> customers that they have to manually go in and kill the process threw the
> task manager i just wanted to check if anyone has a solution to this
> problem?
> Any ideas would be greatly appreciated!
>
> //Ingman
>

 
Reply With Quote
 
Ingman
Guest
Posts: n/a
 
      24th Sep 2008
Hi again,

In my test project im not using anymore code then described above. If I only
use the code below, the instance closes down properly:

Dim xlApp = Excel.Application

Set xlApp = New Excel.Application

xlApp.Quit

Set xlApp = nothing

if i use a workbookreference of any kind the process goes on after quit. So
xlApp.Workbooks.Open doesnt work. Is it something fundamental ive missed??

"Alex Dybenko" wrote:

> Hi,
> try to comment parts of your code between posted parts, to find out which
> line cause this. also look at similar tread here with subject "Excel
> instance remains open", there OP found that line Destination:=Range("A1")
> caused this problem
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Ingman" <(E-Mail Removed)> wrote in message
> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> > Hi all,
> >
> > I want to open and read some information from an excel worksheet from
> > Microsoft Access 2007. Im using early bindings and the code looks
> > something
> > like this.
> >
> > ...
> > Dim xlApp as Excel.application
> > Dim xlWb as Excel.workbook
> > Dim xlWs as Excel.worksheet
> >
> >
> > Set xlapp = New Excel.application
> >
> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> >
> > Set xlWs = xlWb.ActiveSheet
> >
> > ......
> >
> > xlWb.Close
> > xlApp.Quit
> >
> > Set xlWs = Nothing
> > Set xlWb = Nothing
> > Set xlApp = Nothing
> >
> > The problem is that the Excel process continues to live on in processes,
> > ive
> > read a lot about this problem and found no "automatic" solution to it.
> > xlApp
> > is not = nothing, and so process continues to live on. Before i tell my
> > customers that they have to manually go in and kill the process threw the
> > task manager i just wanted to check if anyone has a solution to this
> > problem?
> > Any ideas would be greatly appreciated!
> >
> > //Ingman
> >

 
Reply With Quote
 
Ingman
Guest
Posts: n/a
 
      24th Sep 2008
Hi again,

Tried it with same outcome, except that now it will always be just one
unterminated process which is better I guess. A quick question what will
happen if theres an open process which the user is currently working
with(visible and all) ? 2nd do i have to change to late bindings, or can I do
something similar with early bindings? The reason for this is that i read
somewhere that early bindings are more stable and has overall better
performance.


"Alex Dybenko" wrote:

> Hi,
> can you try this code:
> http://www.mvps.org/access/modules/mdl0006.htm
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Ingman" <(E-Mail Removed)> wrote in message
> news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
> > Hi again,
> >
> > In my test project im not using anymore code then described above. If I
> > only
> > use the code below, the instance closes down properly:
> >
> > Dim xlApp = Excel.Application
> >
> > Set xlApp = New Excel.Application
> >
> > xlApp.Quit
> >
> > Set xlApp = nothing
> >
> > if i use a workbookreference of any kind the process goes on after quit.
> > So
> > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
> > missed??
> >
> > "Alex Dybenko" wrote:
> >
> >> Hi,
> >> try to comment parts of your code between posted parts, to find out which
> >> line cause this. also look at similar tread here with subject "Excel
> >> instance remains open", there OP found that line Destination:=Range("A1")
> >> caused this problem
> >>
> >> --
> >> Best regards,
> >> ___________
> >> Alex Dybenko (MVP)
> >> http://accessblog.net
> >> http://www.PointLtd.com
> >>
> >>
> >> "Ingman" <(E-Mail Removed)> wrote in message
> >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> >> > Hi all,
> >> >
> >> > I want to open and read some information from an excel worksheet from
> >> > Microsoft Access 2007. Im using early bindings and the code looks
> >> > something
> >> > like this.
> >> >
> >> > ...
> >> > Dim xlApp as Excel.application
> >> > Dim xlWb as Excel.workbook
> >> > Dim xlWs as Excel.worksheet
> >> >
> >> >
> >> > Set xlapp = New Excel.application
> >> >
> >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> >> >
> >> > Set xlWs = xlWb.ActiveSheet
> >> >
> >> > ......
> >> >
> >> > xlWb.Close
> >> > xlApp.Quit
> >> >
> >> > Set xlWs = Nothing
> >> > Set xlWb = Nothing
> >> > Set xlApp = Nothing
> >> >
> >> > The problem is that the Excel process continues to live on in
> >> > processes,
> >> > ive
> >> > read a lot about this problem and found no "automatic" solution to it.
> >> > xlApp
> >> > is not = nothing, and so process continues to live on. Before i tell my
> >> > customers that they have to manually go in and kill the process threw
> >> > the
> >> > task manager i just wanted to check if anyone has a solution to this
> >> > problem?
> >> > Any ideas would be greatly appreciated!
> >> >
> >> > //Ingman
> >> >

 
Reply With Quote
 
merwcat
Guest
Posts: n/a
 
      24th Sep 2008
Hi I have run into this problem in the past and the most successful solution
I found was to adapt an Access class library from Gary Robinsons VB123
Toolbox site as the basis for XL automation, its not free but the cost is
minimal and it adapts very easily for all sorts of purposes it never seems to
leave any open processes running except where I do something silly with it. I
use it to produce a lot of Excel charts and reports from access. May not be
the answer you want but it was the solution for me.

"Ingman" wrote:

> Hi again,
>
> Tried it with same outcome, except that now it will always be just one
> unterminated process which is better I guess. A quick question what will
> happen if theres an open process which the user is currently working
> with(visible and all) ? 2nd do i have to change to late bindings, or can I do
> something similar with early bindings? The reason for this is that i read
> somewhere that early bindings are more stable and has overall better
> performance.
>
>
> "Alex Dybenko" wrote:
>
> > Hi,
> > can you try this code:
> > http://www.mvps.org/access/modules/mdl0006.htm
> >
> > --
> > Best regards,
> > ___________
> > Alex Dybenko (MVP)
> > http://accessblog.net
> > http://www.PointLtd.com
> >
> >
> > "Ingman" <(E-Mail Removed)> wrote in message
> > news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
> > > Hi again,
> > >
> > > In my test project im not using anymore code then described above. If I
> > > only
> > > use the code below, the instance closes down properly:
> > >
> > > Dim xlApp = Excel.Application
> > >
> > > Set xlApp = New Excel.Application
> > >
> > > xlApp.Quit
> > >
> > > Set xlApp = nothing
> > >
> > > if i use a workbookreference of any kind the process goes on after quit.
> > > So
> > > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
> > > missed??
> > >
> > > "Alex Dybenko" wrote:
> > >
> > >> Hi,
> > >> try to comment parts of your code between posted parts, to find out which
> > >> line cause this. also look at similar tread here with subject "Excel
> > >> instance remains open", there OP found that line Destination:=Range("A1")
> > >> caused this problem
> > >>
> > >> --
> > >> Best regards,
> > >> ___________
> > >> Alex Dybenko (MVP)
> > >> http://accessblog.net
> > >> http://www.PointLtd.com
> > >>
> > >>
> > >> "Ingman" <(E-Mail Removed)> wrote in message
> > >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> > >> > Hi all,
> > >> >
> > >> > I want to open and read some information from an excel worksheet from
> > >> > Microsoft Access 2007. Im using early bindings and the code looks
> > >> > something
> > >> > like this.
> > >> >
> > >> > ...
> > >> > Dim xlApp as Excel.application
> > >> > Dim xlWb as Excel.workbook
> > >> > Dim xlWs as Excel.worksheet
> > >> >
> > >> >
> > >> > Set xlapp = New Excel.application
> > >> >
> > >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> > >> >
> > >> > Set xlWs = xlWb.ActiveSheet
> > >> >
> > >> > ......
> > >> >
> > >> > xlWb.Close
> > >> > xlApp.Quit
> > >> >
> > >> > Set xlWs = Nothing
> > >> > Set xlWb = Nothing
> > >> > Set xlApp = Nothing
> > >> >
> > >> > The problem is that the Excel process continues to live on in
> > >> > processes,
> > >> > ive
> > >> > read a lot about this problem and found no "automatic" solution to it.
> > >> > xlApp
> > >> > is not = nothing, and so process continues to live on. Before i tell my
> > >> > customers that they have to manually go in and kill the process threw
> > >> > the
> > >> > task manager i just wanted to check if anyone has a solution to this
> > >> > problem?
> > >> > Any ideas would be greatly appreciated!
> > >> >
> > >> > //Ingman
> > >> >

 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      24th Sep 2008
Hi,
advantage of late binding - that it works with any excel version.
Performance for both bindings is the same

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Ingman" <(E-Mail Removed)> wrote in message
news:0600D0D7-5C34-4655-A877-(E-Mail Removed)...
> Hi again,
>
> Tried it with same outcome, except that now it will always be just one
> unterminated process which is better I guess. A quick question what will
> happen if theres an open process which the user is currently working
> with(visible and all) ? 2nd do i have to change to late bindings, or can I
> do
> something similar with early bindings? The reason for this is that i read
> somewhere that early bindings are more stable and has overall better
> performance.
>
>
> "Alex Dybenko" wrote:
>
>> Hi,
>> can you try this code:
>> http://www.mvps.org/access/modules/mdl0006.htm
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>>
>> "Ingman" <(E-Mail Removed)> wrote in message
>> news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
>> > Hi again,
>> >
>> > In my test project im not using anymore code then described above. If I
>> > only
>> > use the code below, the instance closes down properly:
>> >
>> > Dim xlApp = Excel.Application
>> >
>> > Set xlApp = New Excel.Application
>> >
>> > xlApp.Quit
>> >
>> > Set xlApp = nothing
>> >
>> > if i use a workbookreference of any kind the process goes on after
>> > quit.
>> > So
>> > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
>> > missed??
>> >
>> > "Alex Dybenko" wrote:
>> >
>> >> Hi,
>> >> try to comment parts of your code between posted parts, to find out
>> >> which
>> >> line cause this. also look at similar tread here with subject "Excel
>> >> instance remains open", there OP found that line
>> >> Destination:=Range("A1")
>> >> caused this problem
>> >>
>> >> --
>> >> Best regards,
>> >> ___________
>> >> Alex Dybenko (MVP)
>> >> http://accessblog.net
>> >> http://www.PointLtd.com
>> >>
>> >>
>> >> "Ingman" <(E-Mail Removed)> wrote in message
>> >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
>> >> > Hi all,
>> >> >
>> >> > I want to open and read some information from an excel worksheet
>> >> > from
>> >> > Microsoft Access 2007. Im using early bindings and the code looks
>> >> > something
>> >> > like this.
>> >> >
>> >> > ...
>> >> > Dim xlApp as Excel.application
>> >> > Dim xlWb as Excel.workbook
>> >> > Dim xlWs as Excel.worksheet
>> >> >
>> >> >
>> >> > Set xlapp = New Excel.application
>> >> >
>> >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
>> >> >
>> >> > Set xlWs = xlWb.ActiveSheet
>> >> >
>> >> > ......
>> >> >
>> >> > xlWb.Close
>> >> > xlApp.Quit
>> >> >
>> >> > Set xlWs = Nothing
>> >> > Set xlWb = Nothing
>> >> > Set xlApp = Nothing
>> >> >
>> >> > The problem is that the Excel process continues to live on in
>> >> > processes,
>> >> > ive
>> >> > read a lot about this problem and found no "automatic" solution to
>> >> > it.
>> >> > xlApp
>> >> > is not = nothing, and so process continues to live on. Before i tell
>> >> > my
>> >> > customers that they have to manually go in and kill the process
>> >> > threw
>> >> > the
>> >> > task manager i just wanted to check if anyone has a solution to this
>> >> > problem?
>> >> > Any ideas would be greatly appreciated!
>> >> >
>> >> > //Ingman
>> >> >

 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      25th Sep 2008
Try setting each variable to nothing after each is closed as per the
following example. I have had some success with this but have not tested
exhaustively so not really sure if it works in all cases but so far it seems
to be working with my application. I will be interested in what happens with
yours. I adapted it from something unrelated that I found on this forum and
thought it worth a try.

Set xlWs = xlWb.ActiveSheet
Set xlWs = Nothing

xlWb.Close
Set xlWb = Nothing

xlApp.Quit
Set xlApp = Nothing

--
Regards,

OssieMac


"Alex Dybenko" wrote:

> Hi,
> advantage of late binding - that it works with any excel version.
> Performance for both bindings is the same
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Ingman" <(E-Mail Removed)> wrote in message
> news:0600D0D7-5C34-4655-A877-(E-Mail Removed)...
> > Hi again,
> >
> > Tried it with same outcome, except that now it will always be just one
> > unterminated process which is better I guess. A quick question what will
> > happen if theres an open process which the user is currently working
> > with(visible and all) ? 2nd do i have to change to late bindings, or can I
> > do
> > something similar with early bindings? The reason for this is that i read
> > somewhere that early bindings are more stable and has overall better
> > performance.
> >
> >
> > "Alex Dybenko" wrote:
> >
> >> Hi,
> >> can you try this code:
> >> http://www.mvps.org/access/modules/mdl0006.htm
> >>
> >> --
> >> Best regards,
> >> ___________
> >> Alex Dybenko (MVP)
> >> http://accessblog.net
> >> http://www.PointLtd.com
> >>
> >>
> >> "Ingman" <(E-Mail Removed)> wrote in message
> >> news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
> >> > Hi again,
> >> >
> >> > In my test project im not using anymore code then described above. If I
> >> > only
> >> > use the code below, the instance closes down properly:
> >> >
> >> > Dim xlApp = Excel.Application
> >> >
> >> > Set xlApp = New Excel.Application
> >> >
> >> > xlApp.Quit
> >> >
> >> > Set xlApp = nothing
> >> >
> >> > if i use a workbookreference of any kind the process goes on after
> >> > quit.
> >> > So
> >> > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
> >> > missed??
> >> >
> >> > "Alex Dybenko" wrote:
> >> >
> >> >> Hi,
> >> >> try to comment parts of your code between posted parts, to find out
> >> >> which
> >> >> line cause this. also look at similar tread here with subject "Excel
> >> >> instance remains open", there OP found that line
> >> >> Destination:=Range("A1")
> >> >> caused this problem
> >> >>
> >> >> --
> >> >> Best regards,
> >> >> ___________
> >> >> Alex Dybenko (MVP)
> >> >> http://accessblog.net
> >> >> http://www.PointLtd.com
> >> >>
> >> >>
> >> >> "Ingman" <(E-Mail Removed)> wrote in message
> >> >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> >> >> > Hi all,
> >> >> >
> >> >> > I want to open and read some information from an excel worksheet
> >> >> > from
> >> >> > Microsoft Access 2007. Im using early bindings and the code looks
> >> >> > something
> >> >> > like this.
> >> >> >
> >> >> > ...
> >> >> > Dim xlApp as Excel.application
> >> >> > Dim xlWb as Excel.workbook
> >> >> > Dim xlWs as Excel.worksheet
> >> >> >
> >> >> >
> >> >> > Set xlapp = New Excel.application
> >> >> >
> >> >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> >> >> >
> >> >> > Set xlWs = xlWb.ActiveSheet
> >> >> >
> >> >> > ......
> >> >> >
> >> >> > xlWb.Close
> >> >> > xlApp.Quit
> >> >> >
> >> >> > Set xlWs = Nothing
> >> >> > Set xlWb = Nothing
> >> >> > Set xlApp = Nothing
> >> >> >
> >> >> > The problem is that the Excel process continues to live on in
> >> >> > processes,
> >> >> > ive
> >> >> > read a lot about this problem and found no "automatic" solution to
> >> >> > it.
> >> >> > xlApp
> >> >> > is not = nothing, and so process continues to live on. Before i tell
> >> >> > my
> >> >> > customers that they have to manually go in and kill the process
> >> >> > threw
> >> >> > the
> >> >> > task manager i just wanted to check if anyone has a solution to this
> >> >> > problem?
> >> >> > Any ideas would be greatly appreciated!
> >> >> >
> >> >> > //Ingman
> >> >> >

 
Reply With Quote
 
Ingman
Guest
Posts: n/a
 
      25th Sep 2008
Hi all,

And thx for all ideas. Ossie, ive tried your example unfortunatly without
success .... However the solution Alex Dybenko suggested(limiting the
unterminated process to only 1) is ok for this project. I can live with one
unterminated process, just changed to late bindings, thx for the info about
the performance! Also gone check out the 3rd party component recommended for
future projects!

Thank you again for the feedback!



"OssieMac" wrote:

> Try setting each variable to nothing after each is closed as per the
> following example. I have had some success with this but have not tested
> exhaustively so not really sure if it works in all cases but so far it seems
> to be working with my application. I will be interested in what happens with
> yours. I adapted it from something unrelated that I found on this forum and
> thought it worth a try.
>
> Set xlWs = xlWb.ActiveSheet
> Set xlWs = Nothing
>
> xlWb.Close
> Set xlWb = Nothing
>
> xlApp.Quit
> Set xlApp = Nothing
>
> --
> Regards,
>
> OssieMac
>
>
> "Alex Dybenko" wrote:
>
> > Hi,
> > advantage of late binding - that it works with any excel version.
> > Performance for both bindings is the same
> >
> > --
> > Best regards,
> > ___________
> > Alex Dybenko (MVP)
> > http://accessblog.net
> > http://www.PointLtd.com
> >
> >
> > "Ingman" <(E-Mail Removed)> wrote in message
> > news:0600D0D7-5C34-4655-A877-(E-Mail Removed)...
> > > Hi again,
> > >
> > > Tried it with same outcome, except that now it will always be just one
> > > unterminated process which is better I guess. A quick question what will
> > > happen if theres an open process which the user is currently working
> > > with(visible and all) ? 2nd do i have to change to late bindings, or can I
> > > do
> > > something similar with early bindings? The reason for this is that i read
> > > somewhere that early bindings are more stable and has overall better
> > > performance.
> > >
> > >
> > > "Alex Dybenko" wrote:
> > >
> > >> Hi,
> > >> can you try this code:
> > >> http://www.mvps.org/access/modules/mdl0006.htm
> > >>
> > >> --
> > >> Best regards,
> > >> ___________
> > >> Alex Dybenko (MVP)
> > >> http://accessblog.net
> > >> http://www.PointLtd.com
> > >>
> > >>
> > >> "Ingman" <(E-Mail Removed)> wrote in message
> > >> news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
> > >> > Hi again,
> > >> >
> > >> > In my test project im not using anymore code then described above. If I
> > >> > only
> > >> > use the code below, the instance closes down properly:
> > >> >
> > >> > Dim xlApp = Excel.Application
> > >> >
> > >> > Set xlApp = New Excel.Application
> > >> >
> > >> > xlApp.Quit
> > >> >
> > >> > Set xlApp = nothing
> > >> >
> > >> > if i use a workbookreference of any kind the process goes on after
> > >> > quit.
> > >> > So
> > >> > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
> > >> > missed??
> > >> >
> > >> > "Alex Dybenko" wrote:
> > >> >
> > >> >> Hi,
> > >> >> try to comment parts of your code between posted parts, to find out
> > >> >> which
> > >> >> line cause this. also look at similar tread here with subject "Excel
> > >> >> instance remains open", there OP found that line
> > >> >> Destination:=Range("A1")
> > >> >> caused this problem
> > >> >>
> > >> >> --
> > >> >> Best regards,
> > >> >> ___________
> > >> >> Alex Dybenko (MVP)
> > >> >> http://accessblog.net
> > >> >> http://www.PointLtd.com
> > >> >>
> > >> >>
> > >> >> "Ingman" <(E-Mail Removed)> wrote in message
> > >> >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> > >> >> > Hi all,
> > >> >> >
> > >> >> > I want to open and read some information from an excel worksheet
> > >> >> > from
> > >> >> > Microsoft Access 2007. Im using early bindings and the code looks
> > >> >> > something
> > >> >> > like this.
> > >> >> >
> > >> >> > ...
> > >> >> > Dim xlApp as Excel.application
> > >> >> > Dim xlWb as Excel.workbook
> > >> >> > Dim xlWs as Excel.worksheet
> > >> >> >
> > >> >> >
> > >> >> > Set xlapp = New Excel.application
> > >> >> >
> > >> >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> > >> >> >
> > >> >> > Set xlWs = xlWb.ActiveSheet
> > >> >> >
> > >> >> > ......
> > >> >> >
> > >> >> > xlWb.Close
> > >> >> > xlApp.Quit
> > >> >> >
> > >> >> > Set xlWs = Nothing
> > >> >> > Set xlWb = Nothing
> > >> >> > Set xlApp = Nothing
> > >> >> >
> > >> >> > The problem is that the Excel process continues to live on in
> > >> >> > processes,
> > >> >> > ive
> > >> >> > read a lot about this problem and found no "automatic" solution to
> > >> >> > it.
> > >> >> > xlApp
> > >> >> > is not = nothing, and so process continues to live on. Before i tell
> > >> >> > my
> > >> >> > customers that they have to manually go in and kill the process
> > >> >> > threw
> > >> >> > the
> > >> >> > task manager i just wanted to check if anyone has a solution to this
> > >> >> > problem?
> > >> >> > Any ideas would be greatly appreciated!
> > >> >> >
> > >> >> > //Ingman
> > >> >> >

 
Reply With Quote
 
Ingman
Guest
Posts: n/a
 
      25th Sep 2008
Hi again,

Guess I was a little to quick accepting the solution. Consider the following
case, the user has an excel application open before using the access
form(observe only one excel instance is now running). This in itself isnt a
problem, however if the user closes the excel appliction while the code is
running from the access form, an exception in access arises "Object
required", the reason is ofc that the proccess has been terminated by the
user. Are there anyway around this, check after GetObject if the applicaiton
is visible or something like that. Alex do you know in which order your
fIsAppRunning gets the excel process(last/first created etc), could it be
possible to loop threw availaible process until for example a process where
the application isnt visible is recieved?



"Ingman" wrote:

> Hi all,
>
> And thx for all ideas. Ossie, ive tried your example unfortunatly without
> success .... However the solution Alex Dybenko suggested(limiting the
> unterminated process to only 1) is ok for this project. I can live with one
> unterminated process, just changed to late bindings, thx for the info about
> the performance! Also gone check out the 3rd party component recommended for
> future projects!
>
> Thank you again for the feedback!
>
>
>
> "OssieMac" wrote:
>
> > Try setting each variable to nothing after each is closed as per the
> > following example. I have had some success with this but have not tested
> > exhaustively so not really sure if it works in all cases but so far it seems
> > to be working with my application. I will be interested in what happens with
> > yours. I adapted it from something unrelated that I found on this forum and
> > thought it worth a try.
> >
> > Set xlWs = xlWb.ActiveSheet
> > Set xlWs = Nothing
> >
> > xlWb.Close
> > Set xlWb = Nothing
> >
> > xlApp.Quit
> > Set xlApp = Nothing
> >
> > --
> > Regards,
> >
> > OssieMac
> >
> >
> > "Alex Dybenko" wrote:
> >
> > > Hi,
> > > advantage of late binding - that it works with any excel version.
> > > Performance for both bindings is the same
> > >
> > > --
> > > Best regards,
> > > ___________
> > > Alex Dybenko (MVP)
> > > http://accessblog.net
> > > http://www.PointLtd.com
> > >
> > >
> > > "Ingman" <(E-Mail Removed)> wrote in message
> > > news:0600D0D7-5C34-4655-A877-(E-Mail Removed)...
> > > > Hi again,
> > > >
> > > > Tried it with same outcome, except that now it will always be just one
> > > > unterminated process which is better I guess. A quick question what will
> > > > happen if theres an open process which the user is currently working
> > > > with(visible and all) ? 2nd do i have to change to late bindings, or can I
> > > > do
> > > > something similar with early bindings? The reason for this is that i read
> > > > somewhere that early bindings are more stable and has overall better
> > > > performance.
> > > >
> > > >
> > > > "Alex Dybenko" wrote:
> > > >
> > > >> Hi,
> > > >> can you try this code:
> > > >> http://www.mvps.org/access/modules/mdl0006.htm
> > > >>
> > > >> --
> > > >> Best regards,
> > > >> ___________
> > > >> Alex Dybenko (MVP)
> > > >> http://accessblog.net
> > > >> http://www.PointLtd.com
> > > >>
> > > >>
> > > >> "Ingman" <(E-Mail Removed)> wrote in message
> > > >> news:B431D10B-6773-4603-BB4A-(E-Mail Removed)...
> > > >> > Hi again,
> > > >> >
> > > >> > In my test project im not using anymore code then described above. If I
> > > >> > only
> > > >> > use the code below, the instance closes down properly:
> > > >> >
> > > >> > Dim xlApp = Excel.Application
> > > >> >
> > > >> > Set xlApp = New Excel.Application
> > > >> >
> > > >> > xlApp.Quit
> > > >> >
> > > >> > Set xlApp = nothing
> > > >> >
> > > >> > if i use a workbookreference of any kind the process goes on after
> > > >> > quit.
> > > >> > So
> > > >> > xlApp.Workbooks.Open doesnt work. Is it something fundamental ive
> > > >> > missed??
> > > >> >
> > > >> > "Alex Dybenko" wrote:
> > > >> >
> > > >> >> Hi,
> > > >> >> try to comment parts of your code between posted parts, to find out
> > > >> >> which
> > > >> >> line cause this. also look at similar tread here with subject "Excel
> > > >> >> instance remains open", there OP found that line
> > > >> >> Destination:=Range("A1")
> > > >> >> caused this problem
> > > >> >>
> > > >> >> --
> > > >> >> Best regards,
> > > >> >> ___________
> > > >> >> Alex Dybenko (MVP)
> > > >> >> http://accessblog.net
> > > >> >> http://www.PointLtd.com
> > > >> >>
> > > >> >>
> > > >> >> "Ingman" <(E-Mail Removed)> wrote in message
> > > >> >> news:33A702C5-3E19-4875-B122-(E-Mail Removed)...
> > > >> >> > Hi all,
> > > >> >> >
> > > >> >> > I want to open and read some information from an excel worksheet
> > > >> >> > from
> > > >> >> > Microsoft Access 2007. Im using early bindings and the code looks
> > > >> >> > something
> > > >> >> > like this.
> > > >> >> >
> > > >> >> > ...
> > > >> >> > Dim xlApp as Excel.application
> > > >> >> > Dim xlWb as Excel.workbook
> > > >> >> > Dim xlWs as Excel.worksheet
> > > >> >> >
> > > >> >> >
> > > >> >> > Set xlapp = New Excel.application
> > > >> >> >
> > > >> >> > Set xlWB = xlApp.Workbooks.Open(strFilePath)
> > > >> >> >
> > > >> >> > Set xlWs = xlWb.ActiveSheet
> > > >> >> >
> > > >> >> > ......
> > > >> >> >
> > > >> >> > xlWb.Close
> > > >> >> > xlApp.Quit
> > > >> >> >
> > > >> >> > Set xlWs = Nothing
> > > >> >> > Set xlWb = Nothing
> > > >> >> > Set xlApp = Nothing
> > > >> >> >
> > > >> >> > The problem is that the Excel process continues to live on in
> > > >> >> > processes,
> > > >> >> > ive
> > > >> >> > read a lot about this problem and found no "automatic" solution to
> > > >> >> > it.
> > > >> >> > xlApp
> > > >> >> > is not = nothing, and so process continues to live on. Before i tell
> > > >> >> > my
> > > >> >> > customers that they have to manually go in and kill the process
> > > >> >> > threw
> > > >> >> > the
> > > >> >> > task manager i just wanted to check if anyone has a solution to this
> > > >> >> > problem?
> > > >> >> > Any ideas would be greatly appreciated!
> > > >> >> >
> > > >> >> > //Ingman
> > > >> >> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Paste In Outlook 2007 Neil Microsoft Outlook VBA Programming 10 30th Jul 2010 08:17 AM
Insert a bitmap image into excel via maccess code Patrick Microsoft Access Form Coding 0 31st Oct 2008 03:00 AM
Problem automating Outlook 2007 in VB6 Norm Microsoft Outlook VBA Programming 3 24th Sep 2008 11:47 PM
Automating An Excel 2007 Application using VB =?Utf-8?B?QnJhZCBXeWxpZQ==?= Microsoft Excel Programming 2 27th Jan 2007 10:21 PM
problem with maccess nur adila Microsoft Access Macros 1 9th Aug 2003 04:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:36 PM.