Author Topic: Excel VBA send autocad commands  (Read 5041 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Excel VBA send autocad commands
« on: February 13, 2014, 08:04:43 PM »
I am getting better at using VBA for Excel. I was able to find a script macro that could launch Autocad. Can you send commands to the command line of Autocad from an Excel VBA? For example, I want autocad to import an XML. Or have a user select an object to export. We are using Civil 3D. (Referring to a pipe network.)

I don't think there is a method to record mouse clicks and keyboard strokes to a VBA then have it replay from Excel VBA or so.
Civil3D 2020

Bashworth

  • Guest
Re: Excel VBA send autocad commands
« Reply #1 on: April 18, 2014, 05:31:29 PM »
If you just want to dump stuff onto an AutoCAD command line, you could just use:

(variable holding the active drawing).SendCommand

What information is in the XML file that you are wanting to use in AutoCAD?

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Excel VBA send autocad commands
« Reply #2 on: July 14, 2014, 07:35:06 AM »
I have another question on this topic.

How can I get excel (VBA) to send information in cell A1 or similar to the command line? I can hardcode it but that's a lot of code I rather not add. This ties back to the zoom to a str lisp. I can use excel to send the command thru but if A1 is 100 then I would like to click on cell A1 which activates the command to autocad. User does not need to type anything in. Hope that makes sense.
Civil3D 2020