Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Closing Excel From VB

Hi guys
I am having problem in closing the excel application from my COM Component
I have following code in one of my COM method and when the method finishes, I still see Excel application running in task ba

can anyone help me? please can you tell me what i am doing wrong? Thanks in advanc

Dim appXl As Excel.Applicatio
Dim oWorkBook As Excel.Workboo
Dim qTable As Excel.QueryTabl

Set appXl = CreateObject("Excel.Application"
appXl.Workbooks.Open "someifle.xls

'' import the text fil
Set qTable = appXl.ActiveSheet.QueryTables.Add(Connection:=
"TEXT;" & strCSVFileName, Destination:=Range("A1")

For Each oWorkBook In appXl.Workbook
oWorkBook.Close SaveChanges:=Tru
oWorkBook.Application.Qui
Nex

Set qTable = Nothin
appXl.Qui
Set oWorkBook = Nothin
Set appXl = Nothing
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Closing Excel From VB

Sorry Guys
the following statment is not there i just added to varify it works or not It doesnt work

oWorkBook.Application.Qui

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Closing Excel From VB

reverse the lines:

set oWorkbook = nothing
xlApp.Quit

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?Tml0aW4=?=" wrote:

Sorry Guys
the following statment is not there i just added to varify it works or
not It doesnt work

oWorkBook.Application.Quit


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Closing Excel From VB


Hi
I tried it but didn work
here is the new code

Dim appXl As Excel.Application
Dim oWorkBook As Excel.Workbook
Dim qTable As Excel.QueryTable

Set appXl = CreateObject("Excel.Application")
appXl.Workbooks.Open somfile.xls

appXl.Worksheets("Data").Activate
appXl.ActiveSheet.UsedRange.Clear
Set qTable = appXl.ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & strCSVFileName, Destination:=Range("A1"))
Set qTable = Nothing
appXl.Worksheets("Report").Activate
appXl.ActiveSheet.PivotTables("PivotTable1").Pivot Select "",
xlDataAndLabel, True
For Each oWorkBook In appXl.Workbooks
oWorkBook.Close SaveChanges:=True
Next
Set oWorkBook = Nothing
appXl.Quit
Set appXl = Nothing


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Closing Excel From VB

Hi
I tried it but didnt work here is new code
Dim appXl As Excel.Applicatio
Dim oWorkBook As Excel.Workboo
Dim qTable As Excel.QueryTabl

Set appXl = CreateObject("Excel.Application"
appXl.Workbooks.Open somfile.xl

appXl.Worksheets("Data").Activat
appXl.ActiveSheet.UsedRange.Clea
Set qTable = appXl.ActiveSheet.QueryTables.Add(Connection:=
"TEXT;" & strCSVFileName, Destination:=Range("A1")
Set qTable = Nothin
appXl.Worksheets("Report").Activat
appXl.ActiveSheet.PivotTables("PivotTable1").Pivot Select "", xlDataAndLabel, Tru
For Each oWorkBook In appXl.Workbook
oWorkBook.Close SaveChanges:=Tru
Nex
Set oWorkBook = Nothin
appXl.Qui
Set appXl = Nothing
Reply
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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
Closing Excel Marvin Kornblau New Users to Excel 1 January 7th 07 12:57 AM
Closing Excel Diane Excel Discussion (Misc queries) 2 March 24th 05 07:27 PM
closing Excel in VBA Jeff[_29_] Excel Programming 1 April 7th 04 08:56 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 03:23 PM.

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

About Us

"It's about Microsoft Excel"