Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detailed:How to Link AutoCAD R14/2000 with Excel'97 1

Status
Not open for further replies.

son56

Technical User
Jul 10, 2001
6
US
I have created an excel workbook which would create a copy of a given AutoCAD file (drawing or template) with blank data. I want the data (text: for title, date, designer, etc.) to be entered and edited through Excel. There are several worksheets in Excel workbook including the Main Sheet. The data will be entered in the Main Sheet and there's a command button to start the macro. After triggering the macro, the data entered is stored in another worksheet and a drawing in AutoCAD is created with that data. Then on that sheet, the AutoCAD drawing can be edited and opened.

The problem is: If I created another file which is stored in that sheet, the link is also the same. The first data entered is also the contents of the next drawing. Is there a way to copy an AutoCAD drawing, then change its link to another cell. For example, drawing1's data should come from cell A1, then drawing2's data should come from cell A2, and so on. What should I do with the reference drawing or template's link so that when another file is created from it, the file is copied and Saved As to another filename, but the link will be different. What should be the correct macro or command to be used?

Your response will be of great help. Thank you very much in advance.
 
I don’t know how good you are in programming an making macros in VBA. Therefor I will give you some examples you can choose between, depending on your experience. As an start, I will tell you some things you can do, instead of going deeply in to VBA.
Try first:
Write: ”L 0,0 10,10 ” in a cell in Excel. (remember 2 spaces at the end)
Copy the cell
Open AutoCad
Rightclick at the commandline, and a dropdown menu appears.
Select paste.
By this way, you can do a lots of things with AutoCad (AC), but what about saving the drawing you just made?
In AC you can change the value of the command ”FILEDIA”, from 1 to 0. Now you can access all the commands that reads and writes files from the commandline instead of using dialogboxes.
Try to write the following code in 3 cells:
A1: ” L 10,10 0,10 filedia 0 save c:\Delete me.dwg”
A2: ” filedia 1”
A3: ” l 2,2 10,10”
Mark the 3 cells and paste them into AC as described above.

If you have some experiences with VBA, you could try to paste the code as I described above, from Excel, by using the VBA statement: ”Sendkeys”.

If you are quit good, then open VBA and choose ”References…” and load the AutoCad Object Library.
Now you can see a lot of new features in the ”Object Browser”. To get started in this jungle of coding, you may want to have a look on the code I made for Kristina on the thread ”Script for acad….”.

With regards from KBBJ (-:

Don’t hesitate on writing back son56.
 
After some rethinking, I don’t think you can use my answer. Try to send a copy of your Excel-file to: kbobj@hotmail.com and I can try to figure out your problem and answer back here.
 
AUCH I have burnt my fingers! Does anybody knows something about simply linking between Excel and AutoCad, (apparently not Database linking such as ODBC and so on) then come and rescue me. [sub]I have never been there and done that[/sub]

Who? Me? #-) you don't know me
 
Could you explain how to link autocad 2000i w/ a lotus application?...I would like to find a way to have lotus extract information from my drawings in autocad 2000i (or 2000, 2000lt, 2002, doesn't matter)? If you could help me that would be great.
Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top