Accessing AutoCAD documents with Excel
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Accessing AutoCAD documents with Excel

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
e.barelds@beenen.nl
Guest





Posted: Wed Mar 16, 2005 7:14 pm    Post subject: Accessing AutoCAD documents with Excel Reply with quote

Hi,

Is there someone who can tell me what i do wrong;

I'm trying te acces AutoCAD with the following script;

----------------------------------------------
Public objAcadApp As Object
Public objAcadDoc As Object
Public objMSpace As Object

Function IS_ACAD_RUNNING()
On Error Resume Next
Set objAcadApp = GetObject(, "AutoCAD.Application")
If Err Then
MsgBox ("Cant load AutoCAD!" & Chr(13) & Chr(13) & Err.Description)
Err.Clear
End 'Stop the program!
Else
Set objAcadDoc = objAcadApp.ActiveDocument
Set objMSpace = objAcadDoc.ModelSpace
End If

End Function
------------------------------------------------

It does work on one computer, but not on the otherones. The message with I
get is the object is not known?

Grtz, Eddy

Back to top
Mike Tuersley
Guest





Posted: Thu Mar 17, 2005 9:03 am    Post subject: Re: Accessing AutoCAD documents with Excel Reply with quote

Well you code assumes AutoCAD is running, what if it isn't? So assuming
AutoCAD is installed on all the computers, the If Err should be

If Err.Number <> 0 Then
Err.Clear
Set objAcadApp = CreateObject("AutoCAD.Application.{version}")

where {version} is the number of the release you are trying to access --->
R16.0 =2004, R16.1 = 2005, etc.

-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon...
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB