Function GetAcadObject() As Object On Error Resume Next Set GetAcadObject = GetObject(, "AutoCAD.Application") If Err <> 0 Then Err.Clear Set GetAcadObject = CreateObject("AutoCAD.Application") If Err <> 0 Then MsgBox "Could not load or find AutoCAD.", vbExclamation End End If End IfEnd Function

I'll look into the OLE thing, but I might run into problems with versioning if I have to reference the type libraries at design time.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal

hendie

I don't know if this has any relevance but I just tried it using an excel workbook.I could create the application, manipulate cells by sending info from autocad and printout a worksheet all while keeping it invisible

I know you can do it in Excel, because it uses a different mthod of accessing it's data. AutoCAD uses graphical coordinates to manipulate its database. The main reason I am asing is because I have yet to be able to manipulate the AutoCAD model from outside AutoCAD with the AutoCAD window not being the topmost and active window.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal

Keith, If you access a document from the documents collection, instead of using the active document, AND make sure not to do anything to the screen (regen, redraw, zoom) it should work. For example, this works:

Cool... I'll try that...since I am working on existing drawings, I suppose I could open the drawing, grab the drawin object and manipulate it there rather than through the documents collection entirely.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal

I think my problems are going to come into play when I want to execute specific commands on the drawing, rather than attempt to draw an object, I will likely be sending a series of commands, such as plotting, lisp commands, BOM proggies and the such... We'll see how it works out.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal

I know that, but it also will allow the same exact code to be used for ANY version of AutoCAD.Keep in mind that the problem with the Current Version opening (i.e the last version used) can be easily fixed by checking the registry for multiple versions and if there is, request which version the user would like to use.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal

You would have to have each version set to an object... i.e. AutoCAD.Application.15 AutoCAD.Application.16 ... etc...

I am not sure how this would work since there can only be one named reference library at a time. It might mean that you would have to destroy the AC.15 object before you implemented the AC.16 object... I have not tried it so I cannot say for sure... all I can suggest is to try it...

Also remember that once you insert an ole object it becomes referenced by that type library and when you try to move drawings between versions, the ole object may chuck a wobbly....essentially giving an error because of the version.

Logged

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 amCadJockey Militia Field Marshal