Solved

Automation

Posted on 1999-01-25
3
206 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now