Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error about ExcelApp.Workbooks.Add
Hello, It still has the problem.
When I open this created Excel file, then: If I press right-up corner inner X button(This Excel File) === has a problem. If I press File - Digest Information === has a problem. If I press right-up corner outer X button(Excel Application) === No problem. If I press File - Close File === No problem. If I press File - Exit === No problem. (P.S.: Running this web page and opening this Excel file are on the same computer.) If opening this Excel file on other computer, it doesn't have any problems. How to solve it? Thanks. This is the code(web page): It runs on .Net Framework 1.1. ---------------------------------------------------------------------------- - <%@ Page Language="vb" debug="true" % <%@ import Namespace="Excel" % <html <body <% Dim xlApp As Excel.Application xlApp = New Excel.Application() Dim xlWk As Excel.Workbook Dim xlRg As Excel.Range Try xlWk = xlApp.Workbooks.Add() xlRg = xlWk.Worksheets(1).Range("A1") xlRg.Value = "whatever data I want" Dim blah as String blah = "C:\Inetpub\temp\Books.xls" xlWk.SaveAs(blah) xlWk.Close() Catch e As System.Runtime.InteropServices.COMException Response.Write(e) End Try xlApp.Workbooks.Close() xlApp.DisplayAlerts=False xlApp.Quit() xlRg = Nothing xlWk = Nothing xlApp = Nothing % </body </html ---------------------------------------------------------------------------- - "Keith Willshaw" ¼¶¼g©ó¶l¥ó·s»D ... "YaYa" wrote in message ... Thanks. It can create a Excel file now. But, if I open this created Excel file, then close this Excel file, System will show a window: Microsoft Excel occurs problems, it must be closed, sorry. It has three buttons: Debug, Reply this problem, and Not reply. (P.S.: This is I translate strings from Chinese words.) Do you have this problem? And Why? How to solve? Thanks. You need to release all objects and close the Excel instance before ending Typically xlApp.DisplayAlerts=False xlApp.Quit Set xlWk=Nothing Set xlApp=Nothing Keith |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy between workbooks error | Excel Discussion (Misc queries) | |||
Countif error using multiple workbooks | Excel Discussion (Misc queries) | |||
Linking between workbooks and getting #REF error | Excel Discussion (Misc queries) | |||
#Value error when linking workbooks | Excel Worksheet Functions | |||
add-ins error + setting workbooks | Excel Programming |