Cell value to AutoCAD attribute value (Not a Link)??

mnorbury

New Member
Joined
Apr 8, 2011
Messages
1
Hello all. I need a bit of help in understanding some code and getting it to work between excel and AutoCAD. Object is to replace values of attributes in an AutoCAD template with information from cells in a spreadsheet. We have templates and an excel program that will open, fill in a single block instance and save the drawing then go on to next template. We need to be able to fill in the attributes of a block that is in the template 8, 16 or 32 times depending on how many channels are used I a specific template. Values would be different so could use an if statement to identify attribute value to change. Something like
If value = channel1 then
Swap channel1 for B2
End if<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> (something like that :confused: )</o:p>
Code below was given to me as a start but don’t understand how it would work and when I tried to run I got a compile error on the third line.
“If TypeOf b Is AcadBlockReference Then”.
Don’t see how you can pull a cell value into an attribute with this. Below is all the code i was given.
>Dim a, b, n
>For Each b In ThisDrawing.ModelSpace
> If TypeOf b Is AcadBlockReference Then
> a = b.GetAttributes
> For n = 0 To UBound(a)
> If a(n).TagString = "TAG1" Then
> If a(n).TextString = "VALUE" Then
> a(n).TextString = "NEW_VALUE"
> End If
> End If
> Next n
> End If
>Next b
<o:p> </o:p>
Any help with this would be appreciated.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top