<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336779#M86219</link>
    <description>Hi Todd,&lt;BR /&gt;
    Actually, if you know the index of the attribute, you can reference&lt;BR /&gt;
it directly,,, i.e.- the fourth attribute would be  ObjAtt (3), the&lt;BR /&gt;
fifth ObjAtt (4), ect. The attributes are placed in the array in the&lt;BR /&gt;
order they were created or last edited in. But be warned, if you edit&lt;BR /&gt;
the attributes in the block their order will change. I don't mean&lt;BR /&gt;
editing the text string, I mean if you edit one of the attribute&lt;BR /&gt;
definitions in the original block that your inserting. So you only want&lt;BR /&gt;
to do this if you don't foresee ever having to update the block for any&lt;BR /&gt;
reason. Because that would mean updating your code as well. Here's a&lt;BR /&gt;
quick sub that will let you know the order of the attributes. Hope this&lt;BR /&gt;
helps,&lt;BR /&gt;
-Josh&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Sub AttOrder()&lt;BR /&gt;
Dim Ent As AcadEntity, Blk As AcadBlockReference, pt, Atts, I&lt;BR /&gt;
ThisDrawing.Utility.GetEntity Ent, pt, "Select a Block :"&lt;BR /&gt;
If TypeOf Ent Is AcadBlockReference Then&lt;BR /&gt;
    Set Blk = Ent&lt;BR /&gt;
    If Blk.HasAttributes Then&lt;BR /&gt;
        Atts = Blk.GetAttributes&lt;BR /&gt;
        For I = LBound(Atts) To UBound(Atts)&lt;BR /&gt;
            MsgBox "The Attribute at Index (" &amp;amp; I &amp;amp; ") Has the TagString&lt;BR /&gt;
: " &amp;amp; Atts(I).TagString&lt;BR /&gt;
        Next I&lt;BR /&gt;
    End If&lt;BR /&gt;
End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; &amp;gt; If I did just want one value, how would I know which&lt;BR /&gt;
&amp;gt; &amp;gt; index # to use without going thru each one and testing&lt;BR /&gt;
&amp;gt; &amp;gt; the data.</description>
    <pubDate>Tue, 20 Mar 2001 06:37:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-03-20T06:37:57Z</dc:date>
    <item>
      <title>Get Attributes</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336771#M86211</link>
      <description>I'm new to Autocad VBA, so bear with me.&lt;BR /&gt;
I made the following code to try and pull attributes from a selection of&lt;BR /&gt;
blocks, only if they are "PIPE..." blocks.&lt;BR /&gt;
Everything works fine until the "If blockObj.HasAttributes Then" statement.&lt;BR /&gt;
So how do I reference and pull the "value" attribute from each object within&lt;BR /&gt;
a selection set.&lt;BR /&gt;
I would also like to transfer these values to an Access database if anyone&lt;BR /&gt;
has any suggestions for that.&lt;BR /&gt;
Thanks for the response,&lt;BR /&gt;
Todd&lt;BR /&gt;
&lt;BR /&gt;
Private Sub CommandButton1_Click()&lt;BR /&gt;
Dim blockObj As AcadBlockReference&lt;BR /&gt;
Dim ObjAtt As Variant&lt;BR /&gt;
Dim value As String&lt;BR /&gt;
Dim ssetObj As AcadSelectionSet&lt;BR /&gt;
Dim ent As Object&lt;BR /&gt;
Dim mode As Integer&lt;BR /&gt;
Dim rtnPoint1, rtnPoint2 As Variant&lt;BR /&gt;
Dim i As Integer&lt;BR /&gt;
Dim str As String&lt;BR /&gt;
&lt;BR /&gt;
Set ssetObj = ThisDrawing.SelectionSets.Add("pipe")&lt;BR /&gt;
mode = acSelectionSetCrossing&lt;BR /&gt;
Me.Hide&lt;BR /&gt;
rtnPoint1 = ThisDrawing.Utility.GetPoint(, "Point 1 ")&lt;BR /&gt;
rtnPoint2 = ThisDrawing.Utility.GetPoint(, "Point 2 ")&lt;BR /&gt;
&lt;BR /&gt;
ssetObj.Select mode, rtnPoint1, rtnPoint2&lt;BR /&gt;
&lt;BR /&gt;
For Each ent In ssetObj&lt;BR /&gt;
    str = ent.name&lt;BR /&gt;
    If Left(str, 4) = "PIPE" Then&lt;BR /&gt;
        If blockObj.HasAttributes Then&lt;BR /&gt;
        ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
        MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
        End If&lt;BR /&gt;
    End If&lt;BR /&gt;
Next ent&lt;BR /&gt;
End Sub</description>
      <pubDate>Sun, 18 Mar 2001 16:49:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336771#M86211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-18T16:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get Attributes</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336772#M86212</link>
      <description>Hi Todd,&lt;BR /&gt;
The variable blockObj is never set = to the current ent that is a block&lt;BR /&gt;
reference and has a name starting with PIPE, or in other words:&lt;BR /&gt;
This&lt;BR /&gt;
&lt;BR /&gt;
    If Left(str, 4) = "PIPE" Then&lt;BR /&gt;
        If blockObj.HasAttributes Then&lt;BR /&gt;
        ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
        MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
        End If&lt;BR /&gt;
Is missing this&lt;BR /&gt;
&lt;BR /&gt;
Set blockObj = ent&lt;BR /&gt;
&lt;BR /&gt;
So that it will look like:&lt;BR /&gt;
&lt;BR /&gt;
Private Sub CommandButton1_Click()&lt;BR /&gt;
Dim blockObj As AcadBlockReference&lt;BR /&gt;
Dim ObjAtt As Variant&lt;BR /&gt;
Dim value As String&lt;BR /&gt;
Dim ssetObj As AcadSelectionSet&lt;BR /&gt;
Dim ent As Object&lt;BR /&gt;
Dim mode As Integer&lt;BR /&gt;
Dim rtnPoint1, rtnPoint2 As Variant&lt;BR /&gt;
Dim i As Integer&lt;BR /&gt;
Dim str As String&lt;BR /&gt;
&lt;BR /&gt;
Set ssetObj = ThisDrawing.SelectionSets.Add("pipe")&lt;BR /&gt;
mode = acSelectionSetCrossing&lt;BR /&gt;
Me.Hide&lt;BR /&gt;
rtnPoint1 = ThisDrawing.Utility.GetPoint(, "Point 1 ")&lt;BR /&gt;
rtnPoint2 = ThisDrawing.Utility.GetPoint(, "Point 2 ")&lt;BR /&gt;
&lt;BR /&gt;
ssetObj.Select mode, rtnPoint1, rtnPoint2&lt;BR /&gt;
&lt;BR /&gt;
For Each ent In ssetObj&lt;BR /&gt;
    str = ent.Name&lt;BR /&gt;
    If Left(str, 4) = "PIPE" Then&lt;BR /&gt;
      Set blockObj = ent&lt;BR /&gt;
        If blockObj.HasAttributes Then&lt;BR /&gt;
        ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
        MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
        End If&lt;BR /&gt;
    End If&lt;BR /&gt;
Next ent&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
I couldn't resist adding a few other other fine points, try this:&lt;BR /&gt;
&lt;BR /&gt;
Private Sub CommandButton1_Click()&lt;BR /&gt;
  Dim blockObj As AcadBlockReference&lt;BR /&gt;
  Dim ObjAtt As Variant&lt;BR /&gt;
  Dim value As String&lt;BR /&gt;
  Dim intType(1) As Integer&lt;BR /&gt;
  Dim varData(1) As Variant&lt;BR /&gt;
  Dim ssetObj As AcadSelectionSet&lt;BR /&gt;
  Dim mode As Integer&lt;BR /&gt;
  Dim objUtil As AcadUtility&lt;BR /&gt;
  Dim rtnPoint1, rtnPoint2 As Variant&lt;BR /&gt;
  Dim i As Integer&lt;BR /&gt;
  Dim str As String&lt;BR /&gt;
  On Error GoTo Err_Control&lt;BR /&gt;
  intType(0) = 0&lt;BR /&gt;
  varData(0) = "INSERT"&lt;BR /&gt;
  intType(1) = 2&lt;BR /&gt;
  varData(1) = "PIPE*"&lt;BR /&gt;
  Set objUtil = ThisDrawing.Utility&lt;BR /&gt;
  Set ssetObj = ThisDrawing.SelectionSets.Add("pipe")&lt;BR /&gt;
  mode = acSelectionSetCrossing&lt;BR /&gt;
  Me.Hide&lt;BR /&gt;
  rtnPoint1 = objUtil.GetPoint(, "Point 1 ")&lt;BR /&gt;
  objUtil.InitializeUserInput 32&lt;BR /&gt;
  rtnPoint2 = objUtil.GetPoint(rtnPoint1, "Point 2 ")&lt;BR /&gt;
  ssetObj.Select mode, rtnPoint1, rtnPoint2, intType, varData&lt;BR /&gt;
  For Each blockObj In ssetObj&lt;BR /&gt;
    If blockObj.HasAttributes Then&lt;BR /&gt;
      ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
      MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
    End If&lt;BR /&gt;
  Next blockObj&lt;BR /&gt;
  ssetObj.Delete&lt;BR /&gt;
Exit_Here:&lt;BR /&gt;
  Exit Sub&lt;BR /&gt;
Err_Control:&lt;BR /&gt;
  Select Case Err.Number&lt;BR /&gt;
    Case -2145320851&lt;BR /&gt;
      If RemoveSet("pipe") Then&lt;BR /&gt;
        Resume&lt;BR /&gt;
      Else&lt;BR /&gt;
        MsgBox Err.Description&lt;BR /&gt;
        Resume Exit_Here&lt;BR /&gt;
      End If&lt;BR /&gt;
    Case Else&lt;BR /&gt;
      MsgBox Err.Description&lt;BR /&gt;
      Resume Exit_Here&lt;BR /&gt;
  End Select&lt;BR /&gt;
End Sub&lt;BR /&gt;
Function RemoveSet(strName As String) As Boolean&lt;BR /&gt;
  On Error GoTo Err_Control&lt;BR /&gt;
  ThisDrawing.SelectionSets(strName).Delete&lt;BR /&gt;
  RemoveSet = True&lt;BR /&gt;
Exit_Here:&lt;BR /&gt;
  Exit Function&lt;BR /&gt;
Err_Control:&lt;BR /&gt;
  Resume Exit_Here&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Now, lets see, I know I wrote an article with code that will give you just&lt;BR /&gt;
what you need for that data base question ... Ah, here it is. This is from&lt;BR /&gt;
the Jan. 14, 2000 issue of A Code A Day, enjoy:&lt;BR /&gt;
&lt;BR /&gt;
DATABASE  ANYONE?&lt;BR /&gt;
Warning, another boring lesson by my dad ~ Jessica!&lt;BR /&gt;
&lt;BR /&gt;
Ok, lets try that whole database thing over from the beginning. For the sake&lt;BR /&gt;
of expedience I will assume that you are familiar with database structure&lt;BR /&gt;
and SQL and that the only thing I need to provide is the information to work&lt;BR /&gt;
with databases using the languages available to us in VBA. Ralph and I&lt;BR /&gt;
worked for a long time to develop a tutorial that would provide information,&lt;BR /&gt;
working examples, and explanations of the processes involved in database&lt;BR /&gt;
related code. We couldn't do it, so you get this. Ok, just kidding. Lets&lt;BR /&gt;
start with the fundamentals of DAO from a real life view.&lt;BR /&gt;
&lt;BR /&gt;
Creation&lt;BR /&gt;
Before you can create, you need a blue print. For the sake of keeping this&lt;BR /&gt;
AutoCAD related, our blueprint is a block within the drawing, what the block&lt;BR /&gt;
represents does not matter, it need only have attributes (no constant&lt;BR /&gt;
attributes, please) and a name. Creation of the database is easy, so easy it&lt;BR /&gt;
can be done in two lines of VBA code:&lt;BR /&gt;
&lt;BR /&gt;
Dim objDBlk As Database&lt;BR /&gt;
Set objDBlk = CreateDatabase("C:\Block.mdb", dbLangGeneral)&lt;BR /&gt;
&lt;BR /&gt;
As easy as that, there is now a database named Block.mdb at the root of the&lt;BR /&gt;
c drive. Of course it has no records, or tables to contain them, but before&lt;BR /&gt;
we move into building the database structure lets look a little closer at&lt;BR /&gt;
that code:&lt;BR /&gt;
&lt;BR /&gt;
The syntax for the CreateDataBase" method is:&lt;BR /&gt;
&lt;BR /&gt;
CreateDataBase (Name As String, Local As String, [Option])&lt;BR /&gt;
&lt;BR /&gt;
And its return value is the created database. The first argument is clear&lt;BR /&gt;
enough, we need to provide the name for the database (this can also be a&lt;BR /&gt;
network path), but what is "Local"? Its a string that defines the collating&lt;BR /&gt;
order for creating the database! In this case I used "dbLangGeneral" which&lt;BR /&gt;
is a constant from the DAO library for ";LANGID=0x0409;CP=1252;COUNTRY=0"&lt;BR /&gt;
&lt;BR /&gt;
The following list provides all available constants for DAO:&lt;BR /&gt;
&lt;BR /&gt;
dbLangGeneral = English, German, French, Portuguese, Italian, and Modern&lt;BR /&gt;
Spanish&lt;BR /&gt;
dbLangArabic   = Arabic&lt;BR /&gt;
dbLangChineseSimplified  = Simplified Chinese&lt;BR /&gt;
dbLangChineseTraditional  = Traditional Chinese&lt;BR /&gt;
dbLangCyrillic = Russian&lt;BR /&gt;
dbLangCzech = Czech&lt;BR /&gt;
dbLangDutch = Dutch&lt;BR /&gt;
dbLangGreek = Greek&lt;BR /&gt;
dbLangHebrew = Hebrew&lt;BR /&gt;
dbLangHungarian = Hungarian&lt;BR /&gt;
dbLangIcelandic = Icelandic&lt;BR /&gt;
dbLangJapanese = Japanese&lt;BR /&gt;
dbLangKorean = Korean&lt;BR /&gt;
dbLangNordic = Nordic languages (Microsoft Jet database engine version 1.0&lt;BR /&gt;
only)&lt;BR /&gt;
dbLangNorwDan = Norwegian and Danish&lt;BR /&gt;
dbLangPolish = Polish&lt;BR /&gt;
dbLangSlovenian = Slovenian&lt;BR /&gt;
dbLangSpanish = Traditional Spanish&lt;BR /&gt;
dbLangSwedFin = Swedish and Finnish&lt;BR /&gt;
dbLangThai = Thai&lt;BR /&gt;
dbLangTurkish = Turkish&lt;BR /&gt;
&lt;BR /&gt;
You can also provide a password in this string by concatenating the constant&lt;BR /&gt;
and the password like this:&lt;BR /&gt;
&lt;BR /&gt;
 dbLangGeneral &amp;amp; ";pwd=wonderllama"&lt;BR /&gt;
&lt;BR /&gt;
The last argument is for encrypting the database or providing the version&lt;BR /&gt;
that it should be created as. The applicable constants are:&lt;BR /&gt;
&lt;BR /&gt;
dbEncrypt&lt;BR /&gt;
Creates an encrypted database.&lt;BR /&gt;
&lt;BR /&gt;
dbVersion10&lt;BR /&gt;
Creates a database that uses the Microsoft Jet database engine version 1.0&lt;BR /&gt;
file format.&lt;BR /&gt;
&lt;BR /&gt;
dbVersion11&lt;BR /&gt;
Creates a database that uses the Microsoft Jet database engine version 1.1&lt;BR /&gt;
file format.&lt;BR /&gt;
&lt;BR /&gt;
dbVersion20&lt;BR /&gt;
Creates a database that uses the Microsoft Jet database engine version 2.0&lt;BR /&gt;
file format.&lt;BR /&gt;
&lt;BR /&gt;
dbVersion30&lt;BR /&gt;
(Default) Creates a database that uses the Microsoft Jet database engine&lt;BR /&gt;
version 3.0 file format (compatible with version 3.5).&lt;BR /&gt;
&lt;BR /&gt;
There is a hidden aspect to this process. The database is actually being&lt;BR /&gt;
created by a workspace, and by not providing the workspace in the methods&lt;BR /&gt;
syntax DAO uses the default workspace. What is a workspace? Simple stuff&lt;BR /&gt;
really, a workspace is a named session of a database engine (don't even ask)&lt;BR /&gt;
that contains all of the users open databases, log in and off times, etc.&lt;BR /&gt;
For this project, this just isn't needed as the default workspace provides&lt;BR /&gt;
the settings we are going to need. If you are interested in working with&lt;BR /&gt;
Workspaces, I plan on covering them down the road, but the general syntax&lt;BR /&gt;
looks like:&lt;BR /&gt;
&lt;BR /&gt;
Dim objWS As Workspace&lt;BR /&gt;
Dim objDBlk As Database&lt;BR /&gt;
Set objWS = DBEngine(0)&lt;BR /&gt;
Set objDBlk = objWS.CreateDatabase("C:\Block.mdb", dbLangGeneral)&lt;BR /&gt;
&lt;BR /&gt;
Again I will cover the use of Workspace objects in greater detail later. For&lt;BR /&gt;
now we are going to stay focused on the basics.&lt;BR /&gt;
&lt;BR /&gt;
Table for Four, please&lt;BR /&gt;
Now that we have the database creation down, we need to give it some&lt;BR /&gt;
structure so that we can place records into it. In this example we pick a&lt;BR /&gt;
block from the AutoCAD graphics screen and use its structure to provide our&lt;BR /&gt;
database's structure. Lets peek at the process:&lt;BR /&gt;
&lt;BR /&gt;
Public Function CreateDB(strName As String) As Database&lt;BR /&gt;
  Dim objDBBlks As Database&lt;BR /&gt;
  Dim objTbl As TableDef&lt;BR /&gt;
  Dim objFld As Field&lt;BR /&gt;
  Dim objBlk As AcadBlockReference&lt;BR /&gt;
  Dim varAtts As Variant&lt;BR /&gt;
  Dim varPnt As Variant&lt;BR /&gt;
  Dim intCnt As Integer&lt;BR /&gt;
  Dim strPrmpt As String&lt;BR /&gt;
  strPrmpt = "Select a block: "&lt;BR /&gt;
  On Error GoTo Error_Control&lt;BR /&gt;
  ThisDrawing.Utility.GetEntity objBlk, varPnt, strPrmpt&lt;BR /&gt;
  If objBlk.HasAttributes Then&lt;BR /&gt;
    varAtts = objBlk.GetAttributes&lt;BR /&gt;
    Set objDBBlks = CreateDatabase(strName, dbLangGeneral)&lt;BR /&gt;
    Set objTbl = objDBBlks.CreateTableDef(objBlk.Name)&lt;BR /&gt;
      For intCnt = LBound(varAtts) To UBound(varAtts)&lt;BR /&gt;
        Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText)&lt;BR /&gt;
        objTbl.Fields.Append objFld&lt;BR /&gt;
      Next&lt;BR /&gt;
        objDBBlks.TableDefs.Append objTbl&lt;BR /&gt;
      Set CreateDB = objDBBlks&lt;BR /&gt;
  Else&lt;BR /&gt;
    MsgBox "The selected block did not have any attributes"&lt;BR /&gt;
  End If&lt;BR /&gt;
  Exit Function&lt;BR /&gt;
Error_Control:&lt;BR /&gt;
'For example just dump out&lt;BR /&gt;
  MsgBox "unbelievable fatal error, your not even allowed to have this&lt;BR /&gt;
error!"&lt;BR /&gt;
'This will of course leave the calling function open to an error, so there&lt;BR /&gt;
had&lt;BR /&gt;
'better be a test to make sure that this returned something (Not Nothing)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
A few new objects to be defined here, TableDef &amp;amp; field. Think of them in&lt;BR /&gt;
terms of an Excel spreadsheet, where the TableDef is an individual sheet and&lt;BR /&gt;
the Fields are Columns. In this example, we made a new sheet named whatever&lt;BR /&gt;
the block is named and added columns (how many depends on how many&lt;BR /&gt;
attributes the block contained) named after each attribute's tag string.&lt;BR /&gt;
Notice that this procedure is a Function, that is to say, it returns a&lt;BR /&gt;
value. In this case it returns the newly created database, which is, by the&lt;BR /&gt;
way, still open. This particular example is far short of ideal for a&lt;BR /&gt;
database creation. Ralph and I left out creating relationships with existing&lt;BR /&gt;
tables (this can be done even with tables from other databases), Adding an&lt;BR /&gt;
Index (more on that later), and adding queries. Like I said, just the basics&lt;BR /&gt;
for now. A few of the lines need a closer look:&lt;BR /&gt;
&lt;BR /&gt;
Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText)&lt;BR /&gt;
&lt;BR /&gt;
This line provides the name for the field and defines the kind of data that&lt;BR /&gt;
will be stored there, dbText. You can use any of the following constants to&lt;BR /&gt;
define the type for a field,&lt;BR /&gt;
&lt;BR /&gt;
DbBigInt&lt;BR /&gt;
Stores a signed, exact numeric value with precision 19 (signed) or 20&lt;BR /&gt;
(unsigned), scale 0 (signed: -263 = n = 263-1; unsigned: 0 = n = 264-1).&lt;BR /&gt;
&lt;BR /&gt;
DbBinary&lt;BR /&gt;
Stores fixed-length binary data. The maximum length is 255 bytes.&lt;BR /&gt;
&lt;BR /&gt;
DbBoolean&lt;BR /&gt;
A True/False or yes/no value.&lt;BR /&gt;
&lt;BR /&gt;
DbByte&lt;BR /&gt;
Used to hold small positive integer numbers ranging from 0 to 255.&lt;BR /&gt;
&lt;BR /&gt;
DbChar&lt;BR /&gt;
Stores a fixed-length character string.&lt;BR /&gt;
&lt;BR /&gt;
DbCurrency&lt;BR /&gt;
Store numbers with up to 15 digits to the left of the decimal point and 4&lt;BR /&gt;
digits to the right.&lt;BR /&gt;
&lt;BR /&gt;
DbDate&lt;BR /&gt;
A real number (Julian date time see the Llama Files)&lt;BR /&gt;
&lt;BR /&gt;
DbDecimal&lt;BR /&gt;
Stores a signed, exact numeric value with precision p and scale s (1 = p&lt;BR /&gt;
=15; 0 = s = p).&lt;BR /&gt;
&lt;BR /&gt;
DbDouble&lt;BR /&gt;
Holds double-precision floating-point numbers in IEEE format. A Double&lt;BR /&gt;
variable is stored as a 64-bit (8-byte) number ranging in value&lt;BR /&gt;
from -1.79769313486231E308 to -4.94065645841247E-324 for negative values,&lt;BR /&gt;
from 4.94065645841247E-324 to 1.79769313486231E308 for positive values, and&lt;BR /&gt;
0.&lt;BR /&gt;
&lt;BR /&gt;
DbFloat&lt;BR /&gt;
Stores a signed, approximate numeric value with mantissa precision 15 (zero&lt;BR /&gt;
or absolute value 10-308 to 10308).&lt;BR /&gt;
&lt;BR /&gt;
DbGUID&lt;BR /&gt;
A unique identification string used with remote procedure calls.&lt;BR /&gt;
&lt;BR /&gt;
DbInteger&lt;BR /&gt;
An Integer variable stored as a 16-bit (2-byte) number ranging in value&lt;BR /&gt;
from -32,768 to 32,767.&lt;BR /&gt;
&lt;BR /&gt;
DbLong&lt;BR /&gt;
A Long variable stored as a 32-bit (4-byte) number ranging in value&lt;BR /&gt;
from -2,147,483,648 to 2,147,483,647.&lt;BR /&gt;
&lt;BR /&gt;
DbLongBinary&lt;BR /&gt;
Objects created in other applications that can be linked or embedded in a&lt;BR /&gt;
Microsoft Jet database.&lt;BR /&gt;
&lt;BR /&gt;
DbMemo&lt;BR /&gt;
Can contain up to 1.2 GB of text data.&lt;BR /&gt;
&lt;BR /&gt;
DbNumeric&lt;BR /&gt;
Stores a signed, exact numeric value with precision p and scale s (1 = p&lt;BR /&gt;
=15; 0 = s = p).&lt;BR /&gt;
&lt;BR /&gt;
DbSingle&lt;BR /&gt;
Variable stored as a 32-bit (4-byte) number ranging in value&lt;BR /&gt;
from -3.402823E38 to -1.401298E-45 for negative values, from 1.401298E-45 to&lt;BR /&gt;
3.402823E38 for positive values, and 0.&lt;BR /&gt;
&lt;BR /&gt;
DbText&lt;BR /&gt;
Can contain up to 255 characters or the number of characters specified by&lt;BR /&gt;
the Size property of the Field object, whichever is less. If the Size&lt;BR /&gt;
property of the text field is set to 0, the text field can hold up to 255&lt;BR /&gt;
characters of data.&lt;BR /&gt;
&lt;BR /&gt;
DbTime&lt;BR /&gt;
Stores a time value.&lt;BR /&gt;
&lt;BR /&gt;
DbTimeStamp&lt;BR /&gt;
Stores a TimeStamp.&lt;BR /&gt;
&lt;BR /&gt;
DbVarBinary&lt;BR /&gt;
Stores variable-length binary data.&lt;BR /&gt;
&lt;BR /&gt;
Now you might have noticed (assuming you ACCTUALY read all of those) that&lt;BR /&gt;
dbText (the one used in the example) can be limited to the specified size in&lt;BR /&gt;
the "Size" property. Doesn't look like I mentioned anything about a&lt;BR /&gt;
"property" at all in the example, does it? Well, I didn't. I have no idea&lt;BR /&gt;
how long those attribute tag strings are going to be, but if I did, I might&lt;BR /&gt;
have changed that line to:&lt;BR /&gt;
&lt;BR /&gt;
Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText, 15)&lt;BR /&gt;
&lt;BR /&gt;
Or however long I needed the field to be. By doing this I force the users of&lt;BR /&gt;
this database to provide strings of the "size" length (or less).&lt;BR /&gt;
&lt;BR /&gt;
Then there is this line:&lt;BR /&gt;
&lt;BR /&gt;
objTbl.Fields.Append objFld&lt;BR /&gt;
&lt;BR /&gt;
Which very simply adds this new field into the fields collection of the new&lt;BR /&gt;
table definition. Later we do the same thing for the table definition:&lt;BR /&gt;
&lt;BR /&gt;
objDBBlks.TableDefs.Append objTbl&lt;BR /&gt;
&lt;BR /&gt;
Which adds the new table definition to the TableDefs collection of the new&lt;BR /&gt;
database.&lt;BR /&gt;
&lt;BR /&gt;
Simple? Confused? Excited? Let me know what questions you have, or comments,&lt;BR /&gt;
in the next lesson we will cover any of these and do something productive&lt;BR /&gt;
with this code!</description>
      <pubDate>Sun, 18 Mar 2001 20:55:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336772#M86212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-18T20:55:38Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336773#M86213</link>
      <description>Thanks for your help Randall, but now I get an error on the msgbox line that&lt;BR /&gt;
reads "Subscript out of range", am I still doing something wrong?&lt;BR /&gt;
Todd&lt;BR /&gt;
&lt;BR /&gt;
"Randall Rath" &lt;RWRATH73&gt; wrote in message&lt;BR /&gt;
news:CF1EA2C311A3732A6ACB96B1C0AF1B6B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Hi Todd,&lt;BR /&gt;
&amp;gt; The variable blockObj is never set = to the current ent that is a block&lt;BR /&gt;
&amp;gt; reference and has a name starting with PIPE, or in other words:&lt;BR /&gt;
&amp;gt; This&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     If Left(str, 4) = "PIPE" Then&lt;BR /&gt;
&amp;gt;         If blockObj.HasAttributes Then&lt;BR /&gt;
&amp;gt;         ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
&amp;gt;         MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
&amp;gt;         End If&lt;BR /&gt;
&amp;gt; Is missing this&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set blockObj = ent&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; So that it will look like:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Private Sub CommandButton1_Click()&lt;BR /&gt;
&amp;gt; Dim blockObj As AcadBlockReference&lt;BR /&gt;
&amp;gt; Dim ObjAtt As Variant&lt;BR /&gt;
&amp;gt; Dim value As String&lt;BR /&gt;
&amp;gt; Dim ssetObj As AcadSelectionSet&lt;BR /&gt;
&amp;gt; Dim ent As Object&lt;BR /&gt;
&amp;gt; Dim mode As Integer&lt;BR /&gt;
&amp;gt; Dim rtnPoint1, rtnPoint2 As Variant&lt;BR /&gt;
&amp;gt; Dim i As Integer&lt;BR /&gt;
&amp;gt; Dim str As String&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set ssetObj = ThisDrawing.SelectionSets.Add("pipe")&lt;BR /&gt;
&amp;gt; mode = acSelectionSetCrossing&lt;BR /&gt;
&amp;gt; Me.Hide&lt;BR /&gt;
&amp;gt; rtnPoint1 = ThisDrawing.Utility.GetPoint(, "Point 1 ")&lt;BR /&gt;
&amp;gt; rtnPoint2 = ThisDrawing.Utility.GetPoint(, "Point 2 ")&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; ssetObj.Select mode, rtnPoint1, rtnPoint2&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; For Each ent In ssetObj&lt;BR /&gt;
&amp;gt;     str = ent.Name&lt;BR /&gt;
&amp;gt;     If Left(str, 4) = "PIPE" Then&lt;BR /&gt;
&amp;gt;       Set blockObj = ent&lt;BR /&gt;
&amp;gt;         If blockObj.HasAttributes Then&lt;BR /&gt;
&amp;gt;         ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
&amp;gt;         MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
&amp;gt;         End If&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; Next ent&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I couldn't resist adding a few other other fine points, try this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Private Sub CommandButton1_Click()&lt;BR /&gt;
&amp;gt;   Dim blockObj As AcadBlockReference&lt;BR /&gt;
&amp;gt;   Dim ObjAtt As Variant&lt;BR /&gt;
&amp;gt;   Dim value As String&lt;BR /&gt;
&amp;gt;   Dim intType(1) As Integer&lt;BR /&gt;
&amp;gt;   Dim varData(1) As Variant&lt;BR /&gt;
&amp;gt;   Dim ssetObj As AcadSelectionSet&lt;BR /&gt;
&amp;gt;   Dim mode As Integer&lt;BR /&gt;
&amp;gt;   Dim objUtil As AcadUtility&lt;BR /&gt;
&amp;gt;   Dim rtnPoint1, rtnPoint2 As Variant&lt;BR /&gt;
&amp;gt;   Dim i As Integer&lt;BR /&gt;
&amp;gt;   Dim str As String&lt;BR /&gt;
&amp;gt;   On Error GoTo Err_Control&lt;BR /&gt;
&amp;gt;   intType(0) = 0&lt;BR /&gt;
&amp;gt;   varData(0) = "INSERT"&lt;BR /&gt;
&amp;gt;   intType(1) = 2&lt;BR /&gt;
&amp;gt;   varData(1) = "PIPE*"&lt;BR /&gt;
&amp;gt;   Set objUtil = ThisDrawing.Utility&lt;BR /&gt;
&amp;gt;   Set ssetObj = ThisDrawing.SelectionSets.Add("pipe")&lt;BR /&gt;
&amp;gt;   mode = acSelectionSetCrossing&lt;BR /&gt;
&amp;gt;   Me.Hide&lt;BR /&gt;
&amp;gt;   rtnPoint1 = objUtil.GetPoint(, "Point 1 ")&lt;BR /&gt;
&amp;gt;   objUtil.InitializeUserInput 32&lt;BR /&gt;
&amp;gt;   rtnPoint2 = objUtil.GetPoint(rtnPoint1, "Point 2 ")&lt;BR /&gt;
&amp;gt;   ssetObj.Select mode, rtnPoint1, rtnPoint2, intType, varData&lt;BR /&gt;
&amp;gt;   For Each blockObj In ssetObj&lt;BR /&gt;
&amp;gt;     If blockObj.HasAttributes Then&lt;BR /&gt;
&amp;gt;       ObjAtt = blockObj.GetAttributes&lt;BR /&gt;
&amp;gt;       MsgBox "Here is the value " &amp;amp; ObjAtt(0).TextString&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt;   Next blockObj&lt;BR /&gt;
&amp;gt;   ssetObj.Delete&lt;BR /&gt;
&amp;gt; Exit_Here:&lt;BR /&gt;
&amp;gt;   Exit Sub&lt;BR /&gt;
&amp;gt; Err_Control:&lt;BR /&gt;
&amp;gt;   Select Case Err.Number&lt;BR /&gt;
&amp;gt;     Case -2145320851&lt;BR /&gt;
&amp;gt;       If RemoveSet("pipe") Then&lt;BR /&gt;
&amp;gt;         Resume&lt;BR /&gt;
&amp;gt;       Else&lt;BR /&gt;
&amp;gt;         MsgBox Err.Description&lt;BR /&gt;
&amp;gt;         Resume Exit_Here&lt;BR /&gt;
&amp;gt;       End If&lt;BR /&gt;
&amp;gt;     Case Else&lt;BR /&gt;
&amp;gt;       MsgBox Err.Description&lt;BR /&gt;
&amp;gt;       Resume Exit_Here&lt;BR /&gt;
&amp;gt;   End Select&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; Function RemoveSet(strName As String) As Boolean&lt;BR /&gt;
&amp;gt;   On Error GoTo Err_Control&lt;BR /&gt;
&amp;gt;   ThisDrawing.SelectionSets(strName).Delete&lt;BR /&gt;
&amp;gt;   RemoveSet = True&lt;BR /&gt;
&amp;gt; Exit_Here:&lt;BR /&gt;
&amp;gt;   Exit Function&lt;BR /&gt;
&amp;gt; Err_Control:&lt;BR /&gt;
&amp;gt;   Resume Exit_Here&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Now, lets see, I know I wrote an article with code that will give you just&lt;BR /&gt;
&amp;gt; what you need for that data base question ... Ah, here it is. This is from&lt;BR /&gt;
&amp;gt; the Jan. 14, 2000 issue of A Code A Day, enjoy:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DATABASE  ANYONE?&lt;BR /&gt;
&amp;gt; Warning, another boring lesson by my dad ~ Jessica!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Ok, lets try that whole database thing over from the beginning. For the&lt;BR /&gt;
sake&lt;BR /&gt;
&amp;gt; of expedience I will assume that you are familiar with database structure&lt;BR /&gt;
&amp;gt; and SQL and that the only thing I need to provide is the information to&lt;BR /&gt;
work&lt;BR /&gt;
&amp;gt; with databases using the languages available to us in VBA. Ralph and I&lt;BR /&gt;
&amp;gt; worked for a long time to develop a tutorial that would provide&lt;BR /&gt;
information,&lt;BR /&gt;
&amp;gt; working examples, and explanations of the processes involved in database&lt;BR /&gt;
&amp;gt; related code. We couldn't do it, so you get this. Ok, just kidding. Lets&lt;BR /&gt;
&amp;gt; start with the fundamentals of DAO from a real life view.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Creation&lt;BR /&gt;
&amp;gt; Before you can create, you need a blue print. For the sake of keeping this&lt;BR /&gt;
&amp;gt; AutoCAD related, our blueprint is a block within the drawing, what the&lt;BR /&gt;
block&lt;BR /&gt;
&amp;gt; represents does not matter, it need only have attributes (no constant&lt;BR /&gt;
&amp;gt; attributes, please) and a name. Creation of the database is easy, so easy&lt;BR /&gt;
it&lt;BR /&gt;
&amp;gt; can be done in two lines of VBA code:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Dim objDBlk As Database&lt;BR /&gt;
&amp;gt; Set objDBlk = CreateDatabase("C:\Block.mdb", dbLangGeneral)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; As easy as that, there is now a database named Block.mdb at the root of&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; c drive. Of course it has no records, or tables to contain them, but&lt;BR /&gt;
before&lt;BR /&gt;
&amp;gt; we move into building the database structure lets look a little closer at&lt;BR /&gt;
&amp;gt; that code:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The syntax for the CreateDataBase" method is:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; CreateDataBase (Name As String, Local As String, [Option])&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; And its return value is the created database. The first argument is clear&lt;BR /&gt;
&amp;gt; enough, we need to provide the name for the database (this can also be a&lt;BR /&gt;
&amp;gt; network path), but what is "Local"? Its a string that defines the&lt;BR /&gt;
collating&lt;BR /&gt;
&amp;gt; order for creating the database! In this case I used "dbLangGeneral" which&lt;BR /&gt;
&amp;gt; is a constant from the DAO library for ";LANGID=0x0409;CP=1252;COUNTRY=0"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The following list provides all available constants for DAO:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbLangGeneral = English, German, French, Portuguese, Italian, and Modern&lt;BR /&gt;
&amp;gt; Spanish&lt;BR /&gt;
&amp;gt; dbLangArabic   = Arabic&lt;BR /&gt;
&amp;gt; dbLangChineseSimplified  = Simplified Chinese&lt;BR /&gt;
&amp;gt; dbLangChineseTraditional  = Traditional Chinese&lt;BR /&gt;
&amp;gt; dbLangCyrillic = Russian&lt;BR /&gt;
&amp;gt; dbLangCzech = Czech&lt;BR /&gt;
&amp;gt; dbLangDutch = Dutch&lt;BR /&gt;
&amp;gt; dbLangGreek = Greek&lt;BR /&gt;
&amp;gt; dbLangHebrew = Hebrew&lt;BR /&gt;
&amp;gt; dbLangHungarian = Hungarian&lt;BR /&gt;
&amp;gt; dbLangIcelandic = Icelandic&lt;BR /&gt;
&amp;gt; dbLangJapanese = Japanese&lt;BR /&gt;
&amp;gt; dbLangKorean = Korean&lt;BR /&gt;
&amp;gt; dbLangNordic = Nordic languages (Microsoft Jet database engine version 1.0&lt;BR /&gt;
&amp;gt; only)&lt;BR /&gt;
&amp;gt; dbLangNorwDan = Norwegian and Danish&lt;BR /&gt;
&amp;gt; dbLangPolish = Polish&lt;BR /&gt;
&amp;gt; dbLangSlovenian = Slovenian&lt;BR /&gt;
&amp;gt; dbLangSpanish = Traditional Spanish&lt;BR /&gt;
&amp;gt; dbLangSwedFin = Swedish and Finnish&lt;BR /&gt;
&amp;gt; dbLangThai = Thai&lt;BR /&gt;
&amp;gt; dbLangTurkish = Turkish&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; You can also provide a password in this string by concatenating the&lt;BR /&gt;
constant&lt;BR /&gt;
&amp;gt; and the password like this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;  dbLangGeneral &amp;amp; ";pwd=wonderllama"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The last argument is for encrypting the database or providing the version&lt;BR /&gt;
&amp;gt; that it should be created as. The applicable constants are:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbEncrypt&lt;BR /&gt;
&amp;gt; Creates an encrypted database.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbVersion10&lt;BR /&gt;
&amp;gt; Creates a database that uses the Microsoft Jet database engine version 1.0&lt;BR /&gt;
&amp;gt; file format.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbVersion11&lt;BR /&gt;
&amp;gt; Creates a database that uses the Microsoft Jet database engine version 1.1&lt;BR /&gt;
&amp;gt; file format.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbVersion20&lt;BR /&gt;
&amp;gt; Creates a database that uses the Microsoft Jet database engine version 2.0&lt;BR /&gt;
&amp;gt; file format.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; dbVersion30&lt;BR /&gt;
&amp;gt; (Default) Creates a database that uses the Microsoft Jet database engine&lt;BR /&gt;
&amp;gt; version 3.0 file format (compatible with version 3.5).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; There is a hidden aspect to this process. The database is actually being&lt;BR /&gt;
&amp;gt; created by a workspace, and by not providing the workspace in the methods&lt;BR /&gt;
&amp;gt; syntax DAO uses the default workspace. What is a workspace? Simple stuff&lt;BR /&gt;
&amp;gt; really, a workspace is a named session of a database engine (don't even&lt;BR /&gt;
ask)&lt;BR /&gt;
&amp;gt; that contains all of the users open databases, log in and off times, etc.&lt;BR /&gt;
&amp;gt; For this project, this just isn't needed as the default workspace provides&lt;BR /&gt;
&amp;gt; the settings we are going to need. If you are interested in working with&lt;BR /&gt;
&amp;gt; Workspaces, I plan on covering them down the road, but the general syntax&lt;BR /&gt;
&amp;gt; looks like:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Dim objWS As Workspace&lt;BR /&gt;
&amp;gt; Dim objDBlk As Database&lt;BR /&gt;
&amp;gt; Set objWS = DBEngine(0)&lt;BR /&gt;
&amp;gt; Set objDBlk = objWS.CreateDatabase("C:\Block.mdb", dbLangGeneral)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Again I will cover the use of Workspace objects in greater detail later.&lt;BR /&gt;
For&lt;BR /&gt;
&amp;gt; now we are going to stay focused on the basics.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Table for Four, please&lt;BR /&gt;
&amp;gt; Now that we have the database creation down, we need to give it some&lt;BR /&gt;
&amp;gt; structure so that we can place records into it. In this example we pick a&lt;BR /&gt;
&amp;gt; block from the AutoCAD graphics screen and use its structure to provide&lt;BR /&gt;
our&lt;BR /&gt;
&amp;gt; database's structure. Lets peek at the process:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Public Function CreateDB(strName As String) As Database&lt;BR /&gt;
&amp;gt;   Dim objDBBlks As Database&lt;BR /&gt;
&amp;gt;   Dim objTbl As TableDef&lt;BR /&gt;
&amp;gt;   Dim objFld As Field&lt;BR /&gt;
&amp;gt;   Dim objBlk As AcadBlockReference&lt;BR /&gt;
&amp;gt;   Dim varAtts As Variant&lt;BR /&gt;
&amp;gt;   Dim varPnt As Variant&lt;BR /&gt;
&amp;gt;   Dim intCnt As Integer&lt;BR /&gt;
&amp;gt;   Dim strPrmpt As String&lt;BR /&gt;
&amp;gt;   strPrmpt = "Select a block: "&lt;BR /&gt;
&amp;gt;   On Error GoTo Error_Control&lt;BR /&gt;
&amp;gt;   ThisDrawing.Utility.GetEntity objBlk, varPnt, strPrmpt&lt;BR /&gt;
&amp;gt;   If objBlk.HasAttributes Then&lt;BR /&gt;
&amp;gt;     varAtts = objBlk.GetAttributes&lt;BR /&gt;
&amp;gt;     Set objDBBlks = CreateDatabase(strName, dbLangGeneral)&lt;BR /&gt;
&amp;gt;     Set objTbl = objDBBlks.CreateTableDef(objBlk.Name)&lt;BR /&gt;
&amp;gt;       For intCnt = LBound(varAtts) To UBound(varAtts)&lt;BR /&gt;
&amp;gt;         Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText)&lt;BR /&gt;
&amp;gt;         objTbl.Fields.Append objFld&lt;BR /&gt;
&amp;gt;       Next&lt;BR /&gt;
&amp;gt;         objDBBlks.TableDefs.Append objTbl&lt;BR /&gt;
&amp;gt;       Set CreateDB = objDBBlks&lt;BR /&gt;
&amp;gt;   Else&lt;BR /&gt;
&amp;gt;     MsgBox "The selected block did not have any attributes"&lt;BR /&gt;
&amp;gt;   End If&lt;BR /&gt;
&amp;gt;   Exit Function&lt;BR /&gt;
&amp;gt; Error_Control:&lt;BR /&gt;
&amp;gt; 'For example just dump out&lt;BR /&gt;
&amp;gt;   MsgBox "unbelievable fatal error, your not even allowed to have this&lt;BR /&gt;
&amp;gt; error!"&lt;BR /&gt;
&amp;gt; 'This will of course leave the calling function open to an error, so there&lt;BR /&gt;
&amp;gt; had&lt;BR /&gt;
&amp;gt; 'better be a test to make sure that this returned something (Not Nothing)&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; A few new objects to be defined here, TableDef &amp;amp; field. Think of them in&lt;BR /&gt;
&amp;gt; terms of an Excel spreadsheet, where the TableDef is an individual sheet&lt;BR /&gt;
and&lt;BR /&gt;
&amp;gt; the Fields are Columns. In this example, we made a new sheet named&lt;BR /&gt;
whatever&lt;BR /&gt;
&amp;gt; the block is named and added columns (how many depends on how many&lt;BR /&gt;
&amp;gt; attributes the block contained) named after each attribute's tag string.&lt;BR /&gt;
&amp;gt; Notice that this procedure is a Function, that is to say, it returns a&lt;BR /&gt;
&amp;gt; value. In this case it returns the newly created database, which is, by&lt;BR /&gt;
the&lt;BR /&gt;
&amp;gt; way, still open. This particular example is far short of ideal for a&lt;BR /&gt;
&amp;gt; database creation. Ralph and I left out creating relationships with&lt;BR /&gt;
existing&lt;BR /&gt;
&amp;gt; tables (this can be done even with tables from other databases), Adding an&lt;BR /&gt;
&amp;gt; Index (more on that later), and adding queries. Like I said, just the&lt;BR /&gt;
basics&lt;BR /&gt;
&amp;gt; for now. A few of the lines need a closer look:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; This line provides the name for the field and defines the kind of data&lt;BR /&gt;
that&lt;BR /&gt;
&amp;gt; will be stored there, dbText. You can use any of the following constants&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; define the type for a field,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbBigInt&lt;BR /&gt;
&amp;gt; Stores a signed, exact numeric value with precision 19 (signed) or 20&lt;BR /&gt;
&amp;gt; (unsigned), scale 0 (signed: -263 = n = 263-1; unsigned: 0 = n = 264-1).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbBinary&lt;BR /&gt;
&amp;gt; Stores fixed-length binary data. The maximum length is 255 bytes.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbBoolean&lt;BR /&gt;
&amp;gt; A True/False or yes/no value.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbByte&lt;BR /&gt;
&amp;gt; Used to hold small positive integer numbers ranging from 0 to 255.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbChar&lt;BR /&gt;
&amp;gt; Stores a fixed-length character string.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbCurrency&lt;BR /&gt;
&amp;gt; Store numbers with up to 15 digits to the left of the decimal point and 4&lt;BR /&gt;
&amp;gt; digits to the right.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbDate&lt;BR /&gt;
&amp;gt; A real number (Julian date time see the Llama Files)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbDecimal&lt;BR /&gt;
&amp;gt; Stores a signed, exact numeric value with precision p and scale s (1 = p&lt;BR /&gt;
&amp;gt; =15; 0 = s = p).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbDouble&lt;BR /&gt;
&amp;gt; Holds double-precision floating-point numbers in IEEE format. A Double&lt;BR /&gt;
&amp;gt; variable is stored as a 64-bit (8-byte) number ranging in value&lt;BR /&gt;
&amp;gt; from -1.79769313486231E308 to -4.94065645841247E-324 for negative values,&lt;BR /&gt;
&amp;gt; from 4.94065645841247E-324 to 1.79769313486231E308 for positive values,&lt;BR /&gt;
and&lt;BR /&gt;
&amp;gt; 0.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbFloat&lt;BR /&gt;
&amp;gt; Stores a signed, approximate numeric value with mantissa precision 15&lt;BR /&gt;
(zero&lt;BR /&gt;
&amp;gt; or absolute value 10-308 to 10308).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbGUID&lt;BR /&gt;
&amp;gt; A unique identification string used with remote procedure calls.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbInteger&lt;BR /&gt;
&amp;gt; An Integer variable stored as a 16-bit (2-byte) number ranging in value&lt;BR /&gt;
&amp;gt; from -32,768 to 32,767.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbLong&lt;BR /&gt;
&amp;gt; A Long variable stored as a 32-bit (4-byte) number ranging in value&lt;BR /&gt;
&amp;gt; from -2,147,483,648 to 2,147,483,647.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbLongBinary&lt;BR /&gt;
&amp;gt; Objects created in other applications that can be linked or embedded in a&lt;BR /&gt;
&amp;gt; Microsoft Jet database.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbMemo&lt;BR /&gt;
&amp;gt; Can contain up to 1.2 GB of text data.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbNumeric&lt;BR /&gt;
&amp;gt; Stores a signed, exact numeric value with precision p and scale s (1 = p&lt;BR /&gt;
&amp;gt; =15; 0 = s = p).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbSingle&lt;BR /&gt;
&amp;gt; Variable stored as a 32-bit (4-byte) number ranging in value&lt;BR /&gt;
&amp;gt; from -3.402823E38 to -1.401298E-45 for negative values, from 1.401298E-45&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; 3.402823E38 for positive values, and 0.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbText&lt;BR /&gt;
&amp;gt; Can contain up to 255 characters or the number of characters specified by&lt;BR /&gt;
&amp;gt; the Size property of the Field object, whichever is less. If the Size&lt;BR /&gt;
&amp;gt; property of the text field is set to 0, the text field can hold up to 255&lt;BR /&gt;
&amp;gt; characters of data.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbTime&lt;BR /&gt;
&amp;gt; Stores a time value.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbTimeStamp&lt;BR /&gt;
&amp;gt; Stores a TimeStamp.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; DbVarBinary&lt;BR /&gt;
&amp;gt; Stores variable-length binary data.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Now you might have noticed (assuming you ACCTUALY read all of those) that&lt;BR /&gt;
&amp;gt; dbText (the one used in the example) can be limited to the specified size&lt;BR /&gt;
in&lt;BR /&gt;
&amp;gt; the "Size" property. Doesn't look like I mentioned anything about a&lt;BR /&gt;
&amp;gt; "property" at all in the example, does it? Well, I didn't. I have no idea&lt;BR /&gt;
&amp;gt; how long those attribute tag strings are going to be, but if I did, I&lt;BR /&gt;
might&lt;BR /&gt;
&amp;gt; have changed that line to:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Set objFld = objTbl.CreateField(varAtts(intCnt).TagString, dbText, 15)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Or however long I needed the field to be. By doing this I force the users&lt;BR /&gt;
of&lt;BR /&gt;
&amp;gt; this database to provide strings of the "size" length (or less).&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Then there is this line:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; objTbl.Fields.Append objFld&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Which very simply adds this new field into the fields collection of the&lt;BR /&gt;
new&lt;BR /&gt;
&amp;gt; table definition. Later we do the same thing for the table definition:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; objDBBlks.TableDefs.Append objTbl&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Which adds the new table definition to the TableDefs collection of the new&lt;BR /&gt;
&amp;gt; database.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Simple? Confused? Excited? Let me know what questions you have, or&lt;BR /&gt;
comments,&lt;BR /&gt;
&amp;gt; in the next lesson we will cover any of these and do something productive&lt;BR /&gt;
&amp;gt; with this code!&lt;BR /&gt;
&amp;gt;&lt;/RWRATH73&gt;</description>
      <pubDate>Sun, 18 Mar 2001 22:41:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336773#M86213</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-18T22:41:50Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336774#M86214</link>
      <description>Hi Todd,&lt;BR /&gt;
What version of AutoCAD are you working with?&lt;BR /&gt;
Got a Constant Attribute in there?&lt;BR /&gt;
Did you try the modified solution that uses a filter?&lt;BR /&gt;
Have you checked the return value of your objAtt?&lt;BR /&gt;
Is it an array?&lt;BR /&gt;
Is there only one attribute you want the value from?&lt;BR /&gt;
so many questions&lt;BR /&gt;
so little time&lt;BR /&gt;
&lt;BR /&gt;
Randall Rath</description>
      <pubDate>Mon, 19 Mar 2001 00:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336774#M86214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-19T00:43:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336775#M86215</link>
      <description>Randall Rath &lt;RWRATH73&gt; wrote in message&lt;BR /&gt;
news:6D0C458F859563D6AA3E2D37362FDB05@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Hi Todd,&lt;BR /&gt;
&amp;gt; What version of AutoCAD are you working with?              AutoCad 14.01&lt;BR /&gt;
&amp;gt; Got a Constant Attribute in there?&lt;BR /&gt;
Oops, yeah sure do, that was it. How come constants dont work?&lt;BR /&gt;
&amp;gt; Did you try the modified solution that uses a filter?&lt;BR /&gt;
&amp;gt; Have you checked the return value of your objAtt?&lt;BR /&gt;
&amp;gt; Is it an array?&lt;BR /&gt;
&amp;gt; Is there only one attribute you want the value from?            If I did&lt;BR /&gt;
just want one value, how would I know which index # to use&lt;BR /&gt;
&lt;BR /&gt;
without going thru each one and testing the data.&lt;BR /&gt;
&amp;gt; so many questions&lt;BR /&gt;
&amp;gt; so little time&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Randall Rath&lt;BR /&gt;
&amp;gt;&lt;/RWRATH73&gt;</description>
      <pubDate>Mon, 19 Mar 2001 07:16:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336775#M86215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-19T07:16:05Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336776#M86216</link>
      <description>If you are using Option Base 1, your lower bound is 1 not 0.&lt;BR /&gt;
&lt;BR /&gt;
Something else to watch for is that GetAttributes will return an empty array&lt;BR /&gt;
(which cannot be detected with IsEmpty) when a block contains no editable&lt;BR /&gt;
attributes. That's because HasAttributes returns true even if the only&lt;BR /&gt;
attributes are constant.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
Win a free autographed copy of&lt;BR /&gt;
"AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
&lt;BR /&gt;
"Todd Queen" &lt;TBOYGT&gt; wrote in message&lt;BR /&gt;
news:72FFB39821DBA3BF25123CAC2C4A7F5F@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Thanks for your help Randall, but now I get an error on the msgbox line that&lt;BR /&gt;
&amp;gt; reads "Subscript out of range", am I still doing something wrong?&lt;BR /&gt;
&amp;gt; Todd&lt;/TBOYGT&gt;</description>
      <pubDate>Mon, 19 Mar 2001 07:16:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336776#M86216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-19T07:16:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336777#M86217</link>
      <description>&amp;gt; If I did just want one value, how would I know which&lt;BR /&gt;
&amp;gt; index # to use without going thru each one and testing&lt;BR /&gt;
&amp;gt; the data.&lt;BR /&gt;
&lt;BR /&gt;
Actually, that's pretty much the only way to do it.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
Win a free autographed copy of&lt;BR /&gt;
"AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
&lt;BR /&gt;
"Todd Queen" &lt;TQUEEN&gt; wrote in message&lt;BR /&gt;
news:C6F42C7863E313C3CC4755D5FDD7B718@in.WebX.maYIadrTaRb...&lt;/TQUEEN&gt;</description>
      <pubDate>Mon, 19 Mar 2001 07:17:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336777#M86217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-19T07:17:35Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336778#M86218</link>
      <description>Thanks Frank, I guess that's what I will do then. Fun fun.&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo &lt;FRANKO&gt; wrote in message&lt;BR /&gt;
news:FFC85CFF91774F79B5B23F88D8C8308F@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; If I did just want one value, how would I know which&lt;BR /&gt;
&amp;gt; &amp;gt; index # to use without going thru each one and testing&lt;BR /&gt;
&amp;gt; &amp;gt; the data.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Actually, that's pretty much the only way to do it.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; http://www.acadx.com&lt;BR /&gt;
&amp;gt; Win a free autographed copy of&lt;BR /&gt;
&amp;gt; "AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Todd Queen" &lt;TQUEEN&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:C6F42C7863E313C3CC4755D5FDD7B718@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt;&lt;/TQUEEN&gt;&lt;/FRANKO&gt;</description>
      <pubDate>Mon, 19 Mar 2001 14:12:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336778#M86218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-19T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336779#M86219</link>
      <description>Hi Todd,&lt;BR /&gt;
    Actually, if you know the index of the attribute, you can reference&lt;BR /&gt;
it directly,,, i.e.- the fourth attribute would be  ObjAtt (3), the&lt;BR /&gt;
fifth ObjAtt (4), ect. The attributes are placed in the array in the&lt;BR /&gt;
order they were created or last edited in. But be warned, if you edit&lt;BR /&gt;
the attributes in the block their order will change. I don't mean&lt;BR /&gt;
editing the text string, I mean if you edit one of the attribute&lt;BR /&gt;
definitions in the original block that your inserting. So you only want&lt;BR /&gt;
to do this if you don't foresee ever having to update the block for any&lt;BR /&gt;
reason. Because that would mean updating your code as well. Here's a&lt;BR /&gt;
quick sub that will let you know the order of the attributes. Hope this&lt;BR /&gt;
helps,&lt;BR /&gt;
-Josh&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Sub AttOrder()&lt;BR /&gt;
Dim Ent As AcadEntity, Blk As AcadBlockReference, pt, Atts, I&lt;BR /&gt;
ThisDrawing.Utility.GetEntity Ent, pt, "Select a Block :"&lt;BR /&gt;
If TypeOf Ent Is AcadBlockReference Then&lt;BR /&gt;
    Set Blk = Ent&lt;BR /&gt;
    If Blk.HasAttributes Then&lt;BR /&gt;
        Atts = Blk.GetAttributes&lt;BR /&gt;
        For I = LBound(Atts) To UBound(Atts)&lt;BR /&gt;
            MsgBox "The Attribute at Index (" &amp;amp; I &amp;amp; ") Has the TagString&lt;BR /&gt;
: " &amp;amp; Atts(I).TagString&lt;BR /&gt;
        Next I&lt;BR /&gt;
    End If&lt;BR /&gt;
End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; &amp;gt; If I did just want one value, how would I know which&lt;BR /&gt;
&amp;gt; &amp;gt; index # to use without going thru each one and testing&lt;BR /&gt;
&amp;gt; &amp;gt; the data.</description>
      <pubDate>Tue, 20 Mar 2001 06:37:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-attributes/m-p/336779#M86219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-20T06:37:57Z</dc:date>
    </item>
  </channel>
</rss>

