AutoCAD Table modify cell values from Excel VBA controlling code

AutoCAD Table modify cell values from Excel VBA controlling code

kevin_hay
Contributor Contributor
2,142 Views
2 Replies
Message 1 of 3

AutoCAD Table modify cell values from Excel VBA controlling code

kevin_hay
Contributor
Contributor

Hi everyone.

 

I am currently controlling AutoCAD via the send command method from Excel. My code opens up a new instance of AutoCAD, opens up a specific template and then runs a series of commands through this method to construct a completed drawing. (this part is working well)

 

My challenge is to then modify cell values within an existing AutoCAD Table. I had thought I could use the tabledit command, pass the coordinates to select the cell and then drop text into the mtext editor to populate the change, however when pushing the text into the mtext editor it does not accept it. I also tried the sendkeys method and the data only appears once the text editor for the cell is closed.

 

Can anyone recommend a way of accessing the set cell value method via Excel so I can access the cell values directly? I'd rather achieve this than revert back to editing the table directly in autocad via visual lisp.

 

In summary, I have a range of cells in Excel with calculated data from structural calculations that I require to dump into cell values within an existing AutoCAD Table object and I'd like to do this by pushing the data from excel rather than pulling the data into AutoCAD.

 

Thanks,

Kev.

0 Likes
2,143 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor

You need to use vba code to directly edit the table cell contents, not SendCommand. This post should get you started.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

kevin_hay
Contributor
Contributor

Thanks Ed.

 

I'll take a look and see how I get on.

 

Appreciate the input.

 

Cheers,

Kev.

0 Likes