Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default error messages

I have an asp-project in wich I open excel to create a graph.
Everything goes fine, but if i want to test the code again, the page
crashes.
I figured out I that the page crashes because the excel-file I want to
open is still being used (allthough I closed it in the previous
session).

Is there a way to show error messages that say what's happening?
Does anyone know why the file is still in use?

I use the following code:

<%
Option explicit
Dim sTemplateFile
Dim sTargetFile
Dim oExcelApp
Dim oExcelWkb
Dim oExcelSht
Dim oChart
Dim oSourceRange

sTemplateFile = Server.MapPath("\test") & "\testfile.xls"
sTargetFile = Server.MapPath("\test") & "\result.xls"

Const xlWorkSheet = -4167
Const xlLineMarkers = 65
Const xlNormal = -4143
Const xlLeft = -4131
Const xlCenter = -4108
Const xlRight = -4152

%
<html
<head
<titleCreate report</title
</head
<body
<%
'Create an instance of Excel Application
Set oExcelApp = Server.CreateObject("Excel.Application")

'Open template
Set oExcelWkb = oExcelApp.Workbooks.open(sTemplateFile)

'Save copy
oExcelWkb.SaveAs sTargetFile, xlNormal

'Specify worksheet
set oExcelSht = oExcelWkb.worksheets(1)

'Set source range
Set oSourceRange = oExcelSht.Range("A2:B7")

'Create a new Chart Object
Set oChart = oExcelSht.ChartObjects.Add(20, 20, 300, 200)

oChart.Chart.ChartWizard oSourceRange, 2, , 2, 1, 0, 2, "a title"

'Quit Excel
oExcelWkb.close true
Set oExcelSht = Nothing
Set oExcelWkb = Nothing
oExcelApp.Quit
Set oExcelApp = 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
Error Messages msao Excel Worksheet Functions 4 November 17th 09 04:55 PM
Name error messages... Corkey Excel Worksheet Functions 3 December 31st 07 07:11 PM
Error Messages Kathy Excel Discussion (Misc queries) 9 May 16th 06 03:01 PM
error messages bf Excel Discussion (Misc queries) 2 April 12th 06 03:15 AM
Error Messages Brian Matlack[_52_] Excel Programming 1 January 23rd 06 11:55 PM


All times are GMT +1. The time now is 09:21 AM.

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"