Solved

Automation

Posted on 1999-01-25
3
212 Views
Last Modified: 2010-05-03
I have a VB6 app that from titme to time tries to read an AutoCAD drawing to check that the name is the same. However if AutoCAD is busy, I get an error generated by either AutoCAD or windows asking me to cancel or try again. This doesn't always work but in any case interrupts what I am doing in AutoCAD. Error trapping in VB6 doesn't seem to work. How can I test if AutoCAD is busy before trying to read drawing.
0
Comment
Question by:broadbent
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 total points
ID: 1470562
Have it attempt to rename the drawing and that should only succeed if the drawing file is idle.

Also, AutoCAD creates a working file with the same base name as the drawing while it's active. This is a good indicator that the primary .DWG is in use. I think it's called *.DWK but don't bet the farm on it.

M

0
 
LVL 4

Author Comment

by:broadbent
ID: 1470563
Renaming is simple and it works. Thanks.
AutoCAD uses .dwk extensions to signify lock files which can be disabled by the user.
Actually the elegant way (someone else gave me) is to error trap the call using
app.OleServerBusyRaiseError = True
app.OleServerBusyTimeout = 100

thanks anyway and welcome to the points
0
 
LVL 4

Author Comment

by:broadbent
ID: 1470564
Further comment:
Renaming only tests if AutoCAD has loaded the drawing, not whether AutoCAD is busy or not.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question