Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating Excel
Message
From
07/06/2001 18:01:14
 
 
To
All
General information
Forum:
Visual Basic
Category:
COM, DCOM and OLE automation
Title:
Automating Excel
Miscellaneous
Thread ID:
00516687
Message ID:
00516687
Views:
47
I have a routine that creates an Excel spreadsheet in code but have run into few problems. First, here's some code I'm using:
    Dim excelApp As excel.Application
    Dim excelBook As excel.Workbook
    Dim excelSheet As excel.Worksheet
    
    Set excelApp = GetObject(, "Excel.Application")
    If Err.Number <> 0 Then
         Set excelApp = CreateObject("Excel.Application")
    End If
    
    
    *** some code here to add some data ****


    excelApp.Application.Visible = True
    DoEvents
    excelBook.SaveAs "C:\TEST.XLS"
    excelApp.Quit
    
    Set excelSheet = Nothing
    Set excelBook = Nothing
    Set excelApp = Nothing
My problems:
1. When I run the app, Excel flashes briefly and disappears. How do I make it stay visible so that the user can work with it?
2. It appears this instance of Excel is kept alive (although not visible) with the newly created file open. Therefore, I can't reopen the file until I "kill" the instance of "Excel" running via Task Manager. Why isn't it killed when I set the object ref to "Nothing"?

TIA.
It's "my" world. You're just living in it.
Next
Reply
Map
View

Click here to load this message in the networking platform