.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy From Excel to Clipboard then to AutoCAD

2 REPLIES 2
Reply
Message 1 of 3
btillman
1846 Views, 2 Replies

Copy From Excel to Clipboard then to AutoCAD

I am working on a project which up until recently used Excel VBA and AutoCAD. To the point, one of the important things this process did was grab a range of cells in the Excel file and copy them to the clipboard. This range of cells was a nicely formatted table with borders, cell filled colors, etc... and the VBA code would copy it to the clipboard before laumching AutoCAD. Once AutoCAD was opened a LISP program would automatically paste this into the model space. It made a lovely OLE object in AutoCAD with crisp, clear appearance.

 

We are now trying to do away with the VBA part in favor of .NET. I am really at a loss to explain why the code I used before will not work, nor will anything else I try:

 

VBA CODE

Sheets("Sheet2").Select
Range("B1:K93").Copy

 

VB.NET CODE

 

vExcelRange1 - vExcelSheet2.Range("B1:K93")
vExcelRange1.Copy()

 The .NET code is not working at al. Can anyone point me in the correct location for assistane?

2 REPLIES 2
Message 2 of 3

Is Excel still running when you paste the object into AutoCAD?

Message 3 of 3
jgoessens148
in reply to: btillman

I am nearly there just need to get past the Ole text size box.

 

The next command for you is:

 

ThisDrawing.SendCommand "_pasteclip" & vbCr & "2,3" & vbCr

 

Where "2,3" are the coordinates where it would be pasted.

 

To get past the Ole text size box, you need to go to options "system" and uncheck the box with the "Display OLE text size dialog"

 

John

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost