<?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: vba &amp; excel in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591716#M14496</link>
    <description>Oh, my&lt;BR /&gt;
I'm so sorry - I'm very sick now&lt;BR /&gt;
Will be back later say within 2-3 days only&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
    <pubDate>Tue, 24 Nov 2009 08:32:37 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2009-11-24T08:32:37Z</dc:date>
    <item>
      <title>vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591712#M14492</link>
      <description>CAn anyone help?&lt;BR /&gt;
I would like some vba code which can extract select attributes from a title sheet block in a drawing such as&lt;BR /&gt;
Project name,&lt;BR /&gt;
Drawing Title,&lt;BR /&gt;
Drawing Number &amp;amp; Revision&lt;BR /&gt;
and place them on seperate rows into an existing excel spreadsheet say 2 rows below the last row of existing data.&lt;BR /&gt;
&lt;BR /&gt;
John b</description>
      <pubDate>Wed, 18 Nov 2009 22:51:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591712#M14492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-18T22:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591713#M14493</link>
      <description>Check in Help-&amp;gt;Developer Resources-&amp;gt;Autocad Developer Help (search "excel"). &lt;BR /&gt;
There is more available from autodesk website &lt;BR /&gt;
(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&amp;amp;id=2767701) for &lt;BR /&gt;
example.&lt;BR /&gt;
&lt;BR /&gt;
Post back if you don't find what you need.</description>
      <pubDate>Thu, 19 Nov 2009 16:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591713#M14493</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-19T16:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591714#M14494</link>
      <description>Post your sample drawing with this block only here&lt;BR /&gt;
Perhaps I can help&lt;BR /&gt;
Attached is an example that I have a found somewhere&lt;BR /&gt;
(don't remember it)&lt;BR /&gt;
This will get you started&lt;BR /&gt;
Change the file name and sheet name at&lt;BR /&gt;
the start of code&lt;BR /&gt;
&lt;BR /&gt;
~'J'~

Edited by: hallex on Nov 19, 2009 9:19 PM</description>
      <pubDate>Thu, 19 Nov 2009 19:14:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591714#M14494</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2009-11-19T19:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591715#M14495</link>
      <description>Here is the drawing file with the block attached. the attributes i wish to extract are in the boxes&lt;BR /&gt;
Actually i already have code which extracts attributes from a block called cable in the drawings. This extracts to excel and places the data six or seven rows (this can be changed) from the top of the worksheet ok but at this stage the excel sheet is still open with no name. i wish to be able to extract the attribute information at this time from the title block and place this in the first six or seven rows on seperate rows.&lt;BR /&gt;
I would greatly appreciate any help&lt;BR /&gt;
&lt;BR /&gt;
below is my existing code&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Sub Pmark()&lt;BR /&gt;
Dim Excel As Object&lt;BR /&gt;
Dim ExcelSheet As Object&lt;BR /&gt;
Dim RowNum As Integer&lt;BR /&gt;
Dim Array1 As Variant&lt;BR /&gt;
Dim cnt As Integer&lt;BR /&gt;
Dim NumberOfAttributes As Integer&lt;BR /&gt;
Dim Ssnew As AcadSelectionSet&lt;BR /&gt;
Dim Sheet As Object&lt;BR /&gt;
Dim Max As Integer&lt;BR /&gt;
Dim Min As Integer&lt;BR /&gt;
Dim NoOfIndices As Integer&lt;BR /&gt;
Dim blkRef As AcadBlockReference&lt;BR /&gt;
Dim objAtt As AcadAttributeReference&lt;BR /&gt;
Dim objEnt As AcadEntity&lt;BR /&gt;
' Start Excel if not running&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Set Excel = GetObject(, "Excel.Application")&lt;BR /&gt;
If Err &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
Err.Clear&lt;BR /&gt;
Set Excel = CreateObject("Excel.Application")&lt;BR /&gt;
If Err &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
MsgBox "Could Not Load Excel!", vbExclamation&lt;BR /&gt;
End&lt;BR /&gt;
End If&lt;BR /&gt;
End If&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
Excel.Visible = True&lt;BR /&gt;
Excel.Workbooks.Add '............................&lt;BR /&gt;
Excel.workSheets(1).Select&lt;BR /&gt;
'Excel.workSheets("Sheet1").Activate '.......................&lt;BR /&gt;
'Set ExcelSheet = Excel.ActiveWorkbook.Sheets("Sheet1")&lt;BR /&gt;
Set ExcelSheet = Excel.ActiveSheet&lt;BR /&gt;
ExcelSheet.Name = "BOM" '&amp;lt;-- change sheet name by suit&lt;BR /&gt;
''Clear the cells&lt;BR /&gt;
ExcelSheet.Range("A1", "DZ100").Clear&lt;BR /&gt;
ExcelSheet.Range("A1:N1").Font.Bold = True&lt;BR /&gt;
&lt;BR /&gt;
'Get Selection Set of Specific Block with Attributes&lt;BR /&gt;
RowNum = 7                                 'this governs the row the block data from "cable" is placed on&lt;BR /&gt;
Dim Header As Boolean&lt;BR /&gt;
Header = False&lt;BR /&gt;
' The following sets up a selection set from the user for all objects&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
' create set&lt;BR /&gt;
Set Ssnew = ThisDrawing.SelectionSets.Add("BOM")&lt;BR /&gt;
'if statement handles possible selection set error&lt;BR /&gt;
If Err.Number &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
   Set Ssnew = ThisDrawing.SelectionSets.Item("BOM")&lt;BR /&gt;
   Ssnew.Clear&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Dim GC(0 To 1) As Integer&lt;BR /&gt;
Dim GV(0 To 1) As Variant&lt;BR /&gt;
Dim atribs&lt;BR /&gt;
GC(0) = 0&lt;BR /&gt;
GV(0) = "INSERT"&lt;BR /&gt;
GC(1) = 2&lt;BR /&gt;
'---------------------------------------------------&lt;BR /&gt;
'Revise the block name "tendnum1" for your application&lt;BR /&gt;
GV(1) = "cable"&lt;BR /&gt;
'---------------------------------------------------&lt;BR /&gt;
Ssnew.Select acSelectionSetAll, , , GC, GV&lt;BR /&gt;
For Each objEnt In Ssnew&lt;BR /&gt;
   Set blkRef = objEnt&lt;BR /&gt;
   Array1 = blkRef.GetAttributes&lt;BR /&gt;
For cnt = LBound(Array1) To UBound(Array1)&lt;BR /&gt;
   Set objAtt = Array1(cnt)&lt;BR /&gt;
   If Header = False Then&lt;BR /&gt;
'If StrComp(Array1(cnt).EntityName, "AcDbAttribute", 1) = 0 Then '&amp;lt;--extrafluous, you already know this is attribute only&lt;BR /&gt;
   ExcelSheet.Cells(RowNum, cnt + 1).Value = objAtt.TagString&lt;BR /&gt;
'End If&lt;BR /&gt;
End If&lt;BR /&gt;
Next cnt&lt;BR /&gt;
RowNum = RowNum + 1&lt;BR /&gt;
For cnt = LBound(Array1) To UBound(Array1)&lt;BR /&gt;
   Set objAtt = Array1(cnt)&lt;BR /&gt;
   ExcelSheet.Cells(RowNum, cnt + 1).Value = objAtt.TextString&lt;BR /&gt;
Next cnt&lt;BR /&gt;
Header = True&lt;BR /&gt;
Next&lt;BR /&gt;
'some formatting goes here:&lt;BR /&gt;
With ExcelSheet.UsedRange&lt;BR /&gt;
    .Columns.AutoFit&lt;BR /&gt;
    Dim headRng As Excel.Range&lt;BR /&gt;
Set headRng = .Range(Cells(1, 1), Cells(1, UBound(Array1) + 1))&lt;BR /&gt;
   With headRng&lt;BR /&gt;
       .Borders.LineStyle = xlContinuous&lt;BR /&gt;
       .Interior.ColorIndex = 35&lt;BR /&gt;
       .Font.ColorIndex = 5&lt;BR /&gt;
   End With&lt;BR /&gt;
Dim dataRng As Excel.Range&lt;BR /&gt;
    Set dataRng = .Range(Cells(2, 1), Cells(.Rows.Count, UBound(Array1) + 1))&lt;BR /&gt;
         dataRng.Select&lt;BR /&gt;
    With Excel.Selection&lt;BR /&gt;
        .Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("A2") _&lt;BR /&gt;
        , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _&lt;BR /&gt;
        False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _&lt;BR /&gt;
        :=xlSortNormal&lt;BR /&gt;
        .Borders.LineStyle = xlContinuous&lt;BR /&gt;
        .Font.ColorIndex = 9&lt;BR /&gt;
        .Interior.ColorIndex = 34&lt;BR /&gt;
    End With&lt;BR /&gt;
End With&lt;BR /&gt;
Set dataRng = Nothing&lt;BR /&gt;
Set headRng = Nothing&lt;BR /&gt;
Set ExcelSheet = Nothing&lt;BR /&gt;
Ssnew.Delete&lt;BR /&gt;
End Sub</description>
      <pubDate>Tue, 24 Nov 2009 06:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591715#M14495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-24T06:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591716#M14496</link>
      <description>Oh, my&lt;BR /&gt;
I'm so sorry - I'm very sick now&lt;BR /&gt;
Will be back later say within 2-3 days only&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Tue, 24 Nov 2009 08:32:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591716#M14496</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2009-11-24T08:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591717#M14497</link>
      <description>Sorry but your block is buggy&lt;BR /&gt;
It has three duplicate tags&lt;BR /&gt;
I will be follow this rule: all similar tags&lt;BR /&gt;
i declare with increment e.g. TITLE1, TITLE2 etc&lt;BR /&gt;
&lt;BR /&gt;
This will get you started&lt;BR /&gt;
&lt;BR /&gt;
Sub Test()&lt;BR /&gt;
'send attribute data to excel&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim j As Integer&lt;BR /&gt;
    Dim intType(0 To 1) As Integer&lt;BR /&gt;
    Dim varData(0 To 1) As Variant&lt;BR /&gt;
&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
    If Not IsNull(oSset) Then&lt;BR /&gt;
&lt;BR /&gt;
        ThisDrawing.SelectionSets.Item("BOM").Delete&lt;BR /&gt;
    Else&lt;BR /&gt;
    End If&lt;BR /&gt;
    For i = 0 To UserForm1.ListBox1.ListCount&lt;BR /&gt;
        If UserForm1.ListBox1.Selected(i) = True Then&lt;BR /&gt;
&lt;BR /&gt;
            intType(0) = 0&lt;BR /&gt;
            varData(0) = "INSERT"&lt;BR /&gt;
            intType(1) = 2&lt;BR /&gt;
            varData(1) = UserForm1.ListBox1.List(i)&lt;BR /&gt;
            Set oSset = ThisDrawing.SelectionSets.Add("BOM")&lt;BR /&gt;
            oSset.Select acSelectionSetAll, FilterType:=intType, FilterData:=varData&lt;BR /&gt;
        End If&lt;BR /&gt;
&lt;BR /&gt;
    Next i&lt;BR /&gt;
&lt;BR /&gt;
    Dim varPick As Variant&lt;BR /&gt;
    Dim objEnt As AcadEntity&lt;BR /&gt;
    Dim varAttribs As Variant&lt;BR /&gt;
    Dim strAttribs As String&lt;BR /&gt;
    Dim blkCount As Integer&lt;BR /&gt;
    Dim jCounter As Integer&lt;BR /&gt;
    Dim iCounter As Integer&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
    For Each objEnt In oSset&lt;BR /&gt;
        Set oBref = objEnt&lt;BR /&gt;
        If oBref.HasAttributes Then&lt;BR /&gt;
            iCounter = 1&lt;BR /&gt;
            'get attributes&lt;BR /&gt;
            varAttribs = oBref.GetAttributes&lt;BR /&gt;
&lt;BR /&gt;
            ReDim blkData(0 To 7, 0 To 1) As String&lt;BR /&gt;
            blkData(0, 0) = "Block Name"&lt;BR /&gt;
            blkData(0, 1) = oBref.Name&lt;BR /&gt;
&lt;BR /&gt;
            For jCounter = LBound(varAttribs) + 1 To UBound(varAttribs) + 1&lt;BR /&gt;
If varAttribs(jCounter - 1).TagString = "PROJECT" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "ADDRESS" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "SUBURB" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "?" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "TITLE" Then&lt;BR /&gt;
&lt;BR /&gt;
                blkData(jCounter, 0) = varAttribs(jCounter - 1).TagString    'oBRef.Name&lt;BR /&gt;
                blkData(jCounter, 1) = varAttribs(jCounter - 1).TextString&lt;BR /&gt;
                End If&lt;BR /&gt;
            Next jCounter&lt;BR /&gt;
            '            iCounter = iCounter + 1&lt;BR /&gt;
        End If&lt;BR /&gt;
    Next objEnt&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    'export data to Excel&lt;BR /&gt;
    Dim xlApp As Object    'the Excel application&lt;BR /&gt;
    Dim xlSheet As Object    'the Excel sheet&lt;BR /&gt;
    Dim actBook As Object    'the Excel book&lt;BR /&gt;
    Dim xlBook As Object    'the Excel file&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo Err_Control&lt;BR /&gt;
    On Error Resume Next    'prevent stopping if Excel is not open&lt;BR /&gt;
    Set xlApp = GetObject(, "Excel.application")&lt;BR /&gt;
    'activate Excel if open&lt;BR /&gt;
    If Err = 0 Then&lt;BR /&gt;
        Err.Clear&lt;BR /&gt;
    End If&lt;BR /&gt;
    On Error GoTo 0&lt;BR /&gt;
    'activate Excel if open&lt;BR /&gt;
    Set xlApp = CreateObject("Excel.application")&lt;BR /&gt;
    'Open Excel if not open&lt;BR /&gt;
    If Err &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
        MsgBox "Impossible to access Excel"&lt;BR /&gt;
        Exit Sub&lt;BR /&gt;
    End If&lt;BR /&gt;
    xlApp.Visible = True&lt;BR /&gt;
&lt;BR /&gt;
    Set xlBook = xlApp.Workbooks.Add()&lt;BR /&gt;
&lt;BR /&gt;
    Set actBook = xlApp.ActiveWorkbook&lt;BR /&gt;
    Set xlSheet = actBook.Sheets(1)     'activate the sheet&lt;BR /&gt;
    xlSheet.Name = "BOM"&lt;BR /&gt;
&lt;BR /&gt;
    For i = 0 To UBound(blkData, 1)&lt;BR /&gt;
        For j = 0 To 1&lt;BR /&gt;
            xlSheet.Cells(i + 1, j + 1).Value = blkData(i, j)&lt;BR /&gt;
        Next j&lt;BR /&gt;
    Next i&lt;BR /&gt;
&lt;BR /&gt;
    xlSheet.UsedRange.Select&lt;BR /&gt;
    xlSheet.Columns.AutoFit&lt;BR /&gt;
    actBook.SaveAs xlFileName&lt;BR /&gt;
    actBook.Close&lt;BR /&gt;
    Set actBook = Nothing&lt;BR /&gt;
    xlApp.Quit&lt;BR /&gt;
    Set xlApp = Nothing&lt;BR /&gt;
    Unload Me    'ends program closes form&lt;BR /&gt;
&lt;BR /&gt;
Err_Control:&lt;BR /&gt;
    If Err.Number &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;
        MsgBox Err.Description&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Thu, 26 Nov 2009 13:04:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591717#M14497</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2009-11-26T13:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591718#M14498</link>
      <description>Thanks for that although i have a few questions.&lt;BR /&gt;
In the code you mention a userform and userform listbox etc there are no clues as to what they should do.&lt;BR /&gt;
I have changed the reference "Block Name" to the actual Block name&lt;BR /&gt;
I have also highlighted a few other syntax errors which appear in the code&lt;BR /&gt;
The code seems to be opening a new worksheet rather than use the worksheet which is already open can this be changed.&lt;BR /&gt;
&lt;BR /&gt;
Sub Test()&lt;BR /&gt;
'send attribute data to excel&lt;BR /&gt;
Dim i As Integer&lt;BR /&gt;
Dim j As Integer&lt;BR /&gt;
Dim intType(0 To 1) As Integer&lt;BR /&gt;
Dim varData(0 To 1) As Variant&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
If Not IsNull(oSset) Then&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.SelectionSets.Item("BOM").Delete&lt;BR /&gt;
Else&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
For i = 0 To UserForm1.ListBox1.ListCount                             '??????????&lt;BR /&gt;
If UserForm1.ListBox1.Selected(i) = True Then&lt;BR /&gt;
&lt;BR /&gt;
intType(0) = 0&lt;BR /&gt;
varData(0) = "INSERT"&lt;BR /&gt;
intType(1) = 2&lt;BR /&gt;
varData(1) = UserForm1.ListBox1.List(i)                                  '???????????????????/&lt;BR /&gt;
&lt;BR /&gt;
Set oSset = ThisDrawing.SelectionSets.Add("BOM")&lt;BR /&gt;
oSset.Select acSelectionSetAll, FilterType:=intType, FilterData:=varData&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
Next i&lt;BR /&gt;
&lt;BR /&gt;
Dim varPick As Variant&lt;BR /&gt;
Dim objEnt As AcadEntity&lt;BR /&gt;
Dim varAttribs As Variant&lt;BR /&gt;
Dim strAttribs As String&lt;BR /&gt;
Dim blkCount As Integer&lt;BR /&gt;
Dim jCounter As Integer&lt;BR /&gt;
Dim iCounter As Integer&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
For Each objEnt In oSset&lt;BR /&gt;
Set oBref = objEnt&lt;BR /&gt;
If oBref.HasAttributes Then&lt;BR /&gt;
iCounter = 1&lt;BR /&gt;
'get attributes&lt;BR /&gt;
varAttribs = oBref.GetAttributes&lt;BR /&gt;
&lt;BR /&gt;
ReDim blkData(0 To 7, 0 To 1) As String&lt;BR /&gt;
blkData(0, 0) = "a1_title"                                            ' blkData(0, 0) = "Block Name" changed "Block Name" to actual block name&lt;BR /&gt;
blkData(0, 1) = oBref.Name&lt;BR /&gt;
&lt;BR /&gt;
For jCounter = LBound(varAttribs) + 1 To UBound(varAttribs) + 1&lt;BR /&gt;
If varAttribs(jCounter - 1).TagString = "PROJECT" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "ADDRESS" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "SUBURB" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "?" Or _&lt;BR /&gt;
varAttribs(jCounter - 1).TagString = "TITLE" Then&lt;BR /&gt;
&lt;BR /&gt;
blkData(jCounter, 0) = varAttribs(jCounter - 1).TagString 'oBRef.Name&lt;BR /&gt;
blkData(jCounter, 1) = varAttribs(jCounter - 1).TextString&lt;BR /&gt;
End If&lt;BR /&gt;
Next jCounter&lt;BR /&gt;
' iCounter = iCounter + 1&lt;BR /&gt;
End If&lt;BR /&gt;
Next objEnt&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
'export data to Excel&lt;BR /&gt;
Dim xlApp As Object 'the Excel application&lt;BR /&gt;
Dim xlSheet As Object 'the Excel sheet&lt;BR /&gt;
Dim actBook As Object 'the Excel book&lt;BR /&gt;
Dim xlBook As Object 'the Excel file&lt;BR /&gt;
&lt;BR /&gt;
On Error GoTo Err_Control&lt;BR /&gt;
On Error Resume Next 'prevent stopping if Excel is not open&lt;BR /&gt;
Set xlApp = GetObject(, "Excel.application")&lt;BR /&gt;
'activate Excel if open&lt;BR /&gt;
If Err = 0 Then&lt;BR /&gt;
Err.Clear&lt;BR /&gt;
End If&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
'activate Excel if open&lt;BR /&gt;
Set xlApp = CreateObject("Excel.application")&lt;BR /&gt;
'Open Excel if not open&lt;BR /&gt;
If Err 0 Then                                                                      '??????????????????????/ highlights in vis bas editor as syntax error&lt;BR /&gt;
MsgBox "Impossible to access Excel"&lt;BR /&gt;
Exit Sub&lt;BR /&gt;
End If&lt;BR /&gt;
xlApp.Visible = True&lt;BR /&gt;
&lt;BR /&gt;
Set xlBook = xlApp.Workbooks.Add()&lt;BR /&gt;
&lt;BR /&gt;
Set actBook = xlApp.ActiveWorkbook&lt;BR /&gt;
Set xlSheet = actBook.Sheets(1) 'activate the sheet&lt;BR /&gt;
xlSheet.Name = "BOM"&lt;BR /&gt;
&lt;BR /&gt;
For i = 0 To UBound(blkData, 1)&lt;BR /&gt;
For j = 0 To 1&lt;BR /&gt;
xlSheet.Cells(i + 1, j + 1).Value = blkData(i, j)&lt;BR /&gt;
Next j&lt;BR /&gt;
Next i&lt;BR /&gt;
&lt;BR /&gt;
xlSheet.UsedRange.Select&lt;BR /&gt;
xlSheet.Columns.AutoFit&lt;BR /&gt;
actBook.SaveAs xlFileName&lt;BR /&gt;
actBook.Close&lt;BR /&gt;
Set actBook = Nothing&lt;BR /&gt;
xlApp.Quit&lt;BR /&gt;
Set xlApp = Nothing&lt;BR /&gt;
Unload Me 'ends program closes form&lt;BR /&gt;
&lt;BR /&gt;
Err_Control:&lt;BR /&gt;
&lt;BR /&gt;
If Err.Number 0 Then                                                 '??????????????????????/ highlights in vis bas editor as syntax error&lt;BR /&gt;
&lt;BR /&gt;
MsgBox Err.Description&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Fri, 27 Nov 2009 11:19:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591718#M14498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-27T11:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591719#M14499</link>
      <description>Hi&lt;BR /&gt;
You can remove the code block with listbox selection&lt;BR /&gt;
and set block name directly instead with InputBox&lt;BR /&gt;
&lt;BR /&gt;
This expression&lt;BR /&gt;
{code}If Err.Number &amp;lt; &amp;gt; 0 Then{/code}&lt;BR /&gt;
must be:&lt;BR /&gt;
If Err.Number {here is opened and closed corner brackets - not equal to}0 Then&lt;BR /&gt;
It's a forum editor bug&lt;BR /&gt;
&lt;BR /&gt;
~'J'~</description>
      <pubDate>Fri, 27 Nov 2009 12:08:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591719#M14499</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2009-11-27T12:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: vba &amp; excel</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591720#M14500</link>
      <description>I am sorry to bug you but i just cannot seem to get this to work when i try to remove the userform listbox reference or otherwise. also when i do get it to open in excel it opens a whole new instance of excel. Is at all possible you could finish the project for me so that &lt;BR /&gt;
&lt;BR /&gt;
1. When Macro is run it automatically looks for a block in the drawing called a1_title&lt;BR /&gt;
&lt;BR /&gt;
2. It then extracts the attributes as noted in the attached code and places them on seperate rows in the current open spreadsheet.&lt;BR /&gt;
&lt;BR /&gt;
This one seems to be beyond me. Hoping you can help&lt;BR /&gt;
JohnB</description>
      <pubDate>Mon, 30 Nov 2009 10:42:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-excel/m-p/2591720#M14500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-30T10:42:10Z</dc:date>
    </item>
  </channel>
</rss>

