AutoCad VBA problem

I have written a vba program to check students drawings, Line start & end points, circle centre point and radius etc. The info is dumped
into an excel spreadsheet for comparison with a template. If I run the macro twice on the same drawing I get a fatal error in AutoCad and it shuts down but if I close the drawing and open it again before running the program everything is fine. I am using AutoCad 2004. Any ideas would be welcome.
Thanks in advance
Dave
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Without seeing your code it's tough to say. But the first thing I'd look at is if the Excel link is being properly closed/released with each run.
Good Luck, Jeff

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks for the idea Jeff. I'm sure you are right. The problem I have is that I don't want to close either excel or the drawing after the program run and I don't know how to release excel without doing this. My main program code is below.
Dave
Public excel As Object Public excelsheet As Object Public exapp As Object Public rownum As Integer Public colnum As Integer Public spreadsheetname Public selsetexists As Boolean Public ssetObj As AcadSelectionSet
Sub checkcycle1()
'********************************************************* ' Main program '*********************************************************
Set excel = GetObject(, "Excel.application") spreadsheetname = "cycle1" excel.Visible = True 'remove this line to run the macro without ever seeing Excel Set excelsheet = excel.ActiveWorkbook.Sheets(spreadsheetname)
' If selset (selection set used in this code) exists delete it before starting clearselset
Set ssetObj = ThisDrawing.SelectionSets.Add("Selset")
' clear data area in spreadsheet clearsheet ' Put basic info into spreadsheet like dwg name, limits and layers basicinfo 2, 10 ' Put border info into spreadsheet border 120, 5, 15, 10 ' Put titleblock coord's into spreadsheet titleblock 185, 40, 177, 48, 22, 10 ' Put name text details in sheet Textproperties 283, 37.5, 190, 44, 30, 10, "Name Text" ' Put Dwg No: text details in sheet Textproperties 189, 7, 182, 33, 38, 10, "Left aligned text" ' Put cyclists wheel details in sheet Wheel 50, 10, "Wheel" ' Put cyclists body details in sheet cyclistbody 57, 10, "Cyclist Head" ' Put cyclists legs details in sheet cyclistlegs 96.7676, 147.3659, 67, 10, "Cyclist Legs" ' Put intersecting line details in sheet Intersects 70, 150, 90, 130, 77, 10, "Intersecting Lines" ' Put cog wheel details in sheet cogwheel 195, 160, 81, 10, "Cog Wheel" ' Put pedal and link details in sheet PedalandLink 240.6627, 166.1561, 274.641, 180, 96, 10, "Pedal & Link" ' Put chain link details in sheet chainlink 237.5, 117.5, 102, 10, "Chain Link" ' Put caliper top circle details in sheet Calipertop 51.0355, 86.4645, 110, 10, "Caliper Hub" ' Put brake shoe details in sheet Brakeshoe 36.25, 17.5, 117, 10, "Brake Shoe" ' Put saddle details in sheet Saddle 162.5, 65, 123, 10, "Saddle" ' Put light details in sheet light 222.5, 90, 132, 10, "Light" ' Put hidden details in sheet hiddendetail 138, 10, "Hidden Detail"
'********************************************************* ' End Main program '********************************************************* End Sub
On Mon, 10 May 2004 23:47:31 +0100, snipped-for-privacy@ntlworld.com wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks again Jeff
I took your advice, However, AutoCad still gives a fatal error and shuts down.
Dave

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.