AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Excel VBA to drop drawing into AutoCad

0 REPLIES 0
Reply
Message 1 of 1
mklindquist
712 Views, 0 Replies

Excel VBA to drop drawing into AutoCad

I have this VBA that works correctly with AutoCad version 2008 but when tried on a AutoCad 2012 we are getting the following error - usually I get this error when AutoCad is not opened and it is opened:

 

Run-time error '-2147352571 (80020005)':

 

Cannot run 'AUTOCAD..EXE'. The program or one of its components is damaged or missing.

 

---------

 

Here is the code:

 

Private Function SendCommands(CommandString As String) As Boolean

   If Len(CommandString) - InStrRev(CommandString, vbCr) > 2 Then

      CommandString = CommandString & vbCr

   End If

  

   MyVersion = Range("D1")

  

    If MyVersion = "2008" Then App = "AutoCad.R17.DDE"

    If MyVersion = "2010" Then App = "AutoCad.R18.DDE"

    If MyVersion = "2011" Then App = "AutoCad.R181.DDE"

    If MyVersion = "2012" Then App = "AutoCad.R182.DDE"

    If MyVersion = "2013" Then App = "AutoCad.R183.DDE"

   

   Dim Drawing As String

  

        Drawing = Application.DDEInitiate(App:=App, topic:="system")

        Application.DDEExecute Drawing, CommandString

       

End Function

Tags (2)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost