Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've made an application in VB 6.0. From this I do the following:
1. Open specific Excel-file 2. Automatically insert data into the now open Excel, based on values in the VB-application. 3. Cut all bonds to the Excel-application, but leave it open for further work and saving. 4. It should be possible to close the Excel file doing the above several times. This is what I use to open: ---code begin Dim xlo As excel.Application Dim xloW As excel.Workbook Dim myCount As Integer, x As Integer, NewMeasure As Integer Dim isEven As Boolean If xlo Is Nothing Then Set xlo = New excel.Application Else Set xlo = excel.Application End If Set xloW = xlo.Workbooks.Open("u:\excel\kontrolkort.xls") xloW.Application.Visible = True ... ---code end Currently I have a "Set xlo = Nothing" at the end. But if I close Excel, Excel is not visible but I can see it as a running process. If I attempt to open it again through my VB-app it errors. Am I approacihing it wrongly? Regards /Snedker |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set xlo = Nothing just clears the variable.
Try xlo.Quit If I understand what you're trying to do, that should be what you want. - Pikus --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Tue, 23 Dec 2003 16:44:29 -0600, pikus
wrote: Set xlo = Nothing just clears the variable. Try xlo.Quit If I understand what you're trying to do, that should be what you want. xlo.Quit makes the Excel application want to quit. I wish to keep working in it...? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or xloW.Close then.
Maybe I'm just not understanding what you're trying to close and why... - Pikus --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
When Excel remains visible in the task list it is usualy because you've used an Excel global object. Ex: MyValue=range("a1").value will work from VB6 but only because "range" is a global object exposed by Excel's object model. AKA implicit object. Ex: MyValue=xlo.range("a1").value is an explicit object and will be set to nothing when xlo is. On your second point if you set xlo=nothing or close the Excel session the only way to "reconnect" is to use getobject(). Re-running Set xlo = New excel.Application will alway create a NEW session & NEW object. See getobject() in VB6 help for a code example to test for a running Excel object or create a new object if Excel is not running. -- John johnf202 at hotmail dot com "Snedker" wrote in message ... I've made an application in VB 6.0. From this I do the following: 1. Open specific Excel-file 2. Automatically insert data into the now open Excel, based on values in the VB-application. 3. Cut all bonds to the Excel-application, but leave it open for further work and saving. 4. It should be possible to close the Excel file doing the above several times. This is what I use to open: ---code begin Dim xlo As excel.Application Dim xloW As excel.Workbook Dim myCount As Integer, x As Integer, NewMeasure As Integer Dim isEven As Boolean If xlo Is Nothing Then Set xlo = New excel.Application Else Set xlo = excel.Application End If Set xloW = xlo.Workbooks.Open("u:\excel\kontrolkort.xls") xloW.Application.Visible = True ... ---code end Currently I have a "Set xlo = Nothing" at the end. But if I close Excel, Excel is not visible but I can see it as a running process. If I attempt to open it again through my VB-app it errors. Am I approacihing it wrongly? Regards /Snedker |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Closing workbooks w/o closing Excel | Excel Discussion (Misc queries) | |||
2 Label Options - Forms Object vs Control Box Object | Excel Discussion (Misc queries) | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
Range object to Array object conversion | Excel Programming |