LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
RzB RzB is offline
external usenet poster
 
Posts: 27
Default How to keep an instance of Excel away from the user?

Using Office 2002/3 and DAO

I have an Access application that creates a new
spreadsheet basically using the code shown at the
end of this post..

While the spreadsheet is being created I present
the user with a a simple form giving them
feedback on the progress. I make sure they are
unable to do anything else on my Access
application while this is going on.

It all works really well but there is one problem...

If the user opens Excel while the process is
executing and then closes Excel, then my Excel object
in the access code dissapears. A bit fatal.

Is there some way I can open the an instance of
Excel and stop others from using the same instance.

Or is there some better way ?

Many thanks,
Roy

--------------------------------------------
Private m_objXlApp As Excel.Application
Private m_objXlWkb As Excel.Workbook
Private m_objXlSht As Excel.Worksheet
Private m_rngCurrentRange As Excel.Range

Set m_objXlApp = New Excel.Application
m_objXlApp.Visible = False
Set m_objXlWkb = m_objXlApp.Workbooks.Add
Set m_objXlSht = m_objXlWkb.Worksheets("Sheet1")
Set m_rngCurrentRange = m_objXlSht.Range(ProgramTopLeftCell)
.......
m_rngCurrentRange.Offset(intRowPosCount, conZSize) = whatever

etc...all sorts of sheet creation, cell
filling and formatting going on here..
etc...
......
Set m_rngCurrentRange = Nothing
Set m_objXlSht = Nothing

m_objXlWkb.Close
Set m_objXlWkb = Nothing

m_objXlApp.Quit
Set m_objXlApp = Nothing
------------------------------------------


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - New Instance JMay Excel Discussion (Misc queries) 4 November 28th 09 04:55 PM
Closing Excel Instance harkit[_2_] Excel Programming 3 August 17th 05 04:14 PM
How to kill Excel Instance JRudy Excel Programming 4 September 15th 04 09:01 PM
Excel Instance FuzzyLogic Excel Programming 2 February 21st 04 03:41 PM
Second instance of Excel Dom[_2_] Excel Programming 1 August 25th 03 05:37 PM


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"