Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Text from worksheet Excel 97 to text in AutoCAD 14 dwg

103 views
Skip to first unread message

G. de Leeuw

unread,
May 16, 1999, 3:00:00 AM5/16/99
to
The macro shown below is used by me to draw lines in a Autocad14 drawing
from an Excel 97 (Dutch version) worksheet.
In this case the x and y coördinates of the beginningpoint of the first
line are mentioned in cells I13, J13 and the x and y coördinates of the
endpoint in cells K13, L13.
The x and y coördinates of the beginningpoint of the last line are in cells
I62, J62 and those of the endpoint in cells K62, L62.

On the same worksheet are numbers which should be placed in the drawing as
a text in the Position: 90°, Textstyle: standaard Hight: 25 mm and Color: 3
(green)
.
The first number is placed in cel BB13 and the x and y coördinates of the
beginningpoint are in cells BC13, BD13
The last number is in cel BB62 and the beginningpoint x and y coördinates
of this text are in cells BC62, BD62.

My question is how I should modify the macro shown below to achieve that
the numbers are placed in the drawing as Text, by executing this macro.

Macro used for drawing lines:

Global KanaalNr
Function ACADStr(x)
Td1 = Str(x)
ACADStr = Mid(Td1, InStr(Td1, " ") + 1)
End Function
Sub Invoeren(Commando)
Td1 = "[" & Commando & Chr(13) & "]"
Application.DDEExecute KanaalNr, Td1
End Sub
Sub ACADCommando(functie)
Invoeren Chr(27) & Chr(27) & functie
End Sub
Sub ACADWaarde(x)
Invoeren ACADStr(x)
End Sub
Sub ACADPunt(x, y)
Invoeren ACADStr(x) & "," & ACADStr(y)
End Sub
Sub lijn(x1, y1, x2, y2)
ACADCommando "Line"
ACADPunt x1, y1
ACADPunt x2, y2
Invoeren ""
End Sub 'Einde Lijn
Sub cirkel(x, y, r)
ACADCommando "Circle"
ACADPunt x, y
ACADWaarde r
End Sub 'Einde cirkel
Sub boog(x, y, x1, y1, hoek)
ACADCommando "Arc"
Invoeren "C'
ACADPunt x, y
ACADPunt x1, y1
Invoeren "A"
ACADWaarde hoek
End Sub 'Einde boog
Sub(x, y, h, txtRegel)
ACADCommando "TEXT"
ACADPunt x, y
ACADWaarde h
ACADWaarde 0
Invoeren txtRegel
End Sub 'Einde tekst
Sub kleur(waarde)
ACADCommando "CECOLOR"
Invoeren waarde
End Sub 'Einde kleur
Sub lijnsoort(waarde)
ACADCommando "-LINETYPE"
Invoeren "S"
Invoeren waarde
Invoeren ""
End Sub 'Einde lijnsoort


Function xVeld(i, j)
xVeld = Worksheets("Blad1") . Cells(i, j) .Value
End Function 'Einde xVeld

Sub Macro1()
'
'
KanaalNr = Application.DDEInitiate("AutoCAD.r14.DDE", "System")

i = 13
Do
lijn xVeld(i, 9), xVeld(i, 10), xVeld(i, 11), xVeld(i, 12)
i = 1 + 1
kleur 4
lijnsoort "continuous"
Loop Until xVeld(i, 1) = ""

Application.DDETerminate KanaalNr
'
End Sub

This macro I have taken from the book AutoCAD LT98, Computer Ondersteunend
Ontwerpen by ir. R. Boeklagen.. and modyfied by me for use with AutoCad R14
(For use with AutoCAD LT98 the part ("AutoCAD.r14.DDE", "System") should
be modyfied in ("AutoCAD LT.DDE", "System")) and for the lager number of
lines I have to draw.

The macro as it is allows me to import some text into a drawing, but only
text placed directly in the macro.
I have no idea how to change the macro to make it possible to read the text
from the given cells, and place that text into the drawing on the place
specified by the contents of the cells next to the cells with the text.

I hope there is someone in this newsgroup who knows how I can get working
the macro as I want, and is willing to tell me what to do.

Because I am not used to write messages in the English language I hope you
will forgive me the gramatical errors which ,no doubt, are in this message.


Thanks, in advance, for any help.

G. de Leeuw
ger....@wxs.nl

0 new messages