Results 1 to 1 of 1

Thread: Pushing Door Data from ADT to Excel

  1. #1
    100 Club pdavis's Avatar
    Join Date
    2005-01
    Location
    Tampa, Fl
    Posts
    188
    Login to Give a bone
    0

    Default Pushing Door Data from ADT to Excel

    first, I am by far not a programmer or VBA expert. I am a hack just trying to get by.

    There is a problem with this routine running in ADT. I am trying to push out the door information to excel and everything seems to work, except for the formating of the door size text in excel. I have attached a jpeg of the excel output and the vba code is below.

    Thanks.

    Code:
    Option Explicit
    Public Sub PushToExcel()
        Dim oExcel As Excel.Application
        Dim oXWorkbook As Excel.Workbook
        Dim oXSheet As Excel.Worksheet
        
        Set oExcel = GetObject(, "Excel.Application")
        Set oXWorkbook = oExcel.ActiveWorkbook
        Set oXSheet = oXWorkbook.ActiveSheet
        
        Dim ent As AcadEntity
        Dim Door As AecDoor
        Dim schApp As New AecScheduleApplication
        Dim cPropSets As AecSchedulePropertySets
        Dim propSet1 As AecSchedulePropertySet
        Dim propSet2 As AecSchedulePropertySet
        Dim propSet3 As AecSchedulePropertySet
        Dim cProps As AecScheduleProperties
        Dim prop As AecScheduleProperty
        Dim i As Integer
        i = 4
       
        oXSheet.Cells(i, 1).NumberFormat = "@"
        oXSheet.Cells(4, 1).Value = "Handle"
    '    PROPERTY SET: HNTBDOOR
        oXSheet.Cells(4, 3).Value = "Door No."
        oXSheet.Cells(4, 6).Value = "Type"
        oXSheet.Cells(4, 7).Value = "Material"
        oXSheet.Cells(4, 15).Value = "Fire Rating"
        oXSheet.Cells(4, 8).Value = "Glazing"
        oXSheet.Cells(4, 16).Value = "Remarks"
        oXSheet.Cells(4, 17).Value = "Rev#"
    '    PROPERTY SET: HNTBFrame
        oXSheet.Cells(4, 9).Value = "Type"
        oXSheet.Cells(4, 10).Value = "Frame Material"
        oXSheet.Cells(4, 11).Value = "Head"
        oXSheet.Cells(4, 12).Value = "Jamb"
        oXSheet.Cells(4, 13).Value = "Threshold"
        oXSheet.Cells(4, 14).Value = "Set Number"
    '    Property Set: HNTBDoorStyles
        oXSheet.Cells(4, 2).Value = "Style"
        oXSheet.Cells(4, 5).Value = "Thickness"
        oXSheet.Cells(4, 4).Value = "Door Size"
        
        
        For Each ent In ThisDrawing.ModelSpace
            If TypeOf ent Is AecDoor Then
                Set Door = ent
                Set cPropSets = schApp.PropertySets(Door)
                Set propSet1 = cPropSets.Item("HNTBDoor")
                Set propSet2 = cPropSets.Item("HNTBFrame")
                Set propSet3 = cPropSets.Item("HNTBDoorStyles")
                If Not propSet1 Is Nothing Then
                    i = i + 1
                        Set cProps = propSet1.Properties
                        
                        oXSheet.Cells(i, 1).NumberFormat = "@"
                        oXSheet.Cells(i, 1).Value = cProps.Item("Handle").Value
                        oXSheet.Cells(i, 3).Value = cProps.Item("DoorNumber").Value
                        oXSheet.Cells(i, 6).Value = cProps.Item("Type").Value
                        oXSheet.Cells(i, 7).Value = cProps.Item("Material").Value
                        oXSheet.Cells(i, 15).Value = cProps.Item("FireRating").Value
                        oXSheet.Cells(i, 8).Value = cProps.Item("Glazing").Value
                        oXSheet.Cells(i, 16).Value = cProps.Item("Remarks").Value
                        oXSheet.Cells(i, 17).Value = cProps.Item("Rev#").Value
    
                        Set cProps = propSet2.Properties
                        
                        oXSheet.Cells(i, 9).Value = cProps.Item("Type").Value
                        oXSheet.Cells(i, 10).Value = cProps.Item("Material").Value
                        oXSheet.Cells(i, 11).Value = cProps.Item("Head").Value
                        oXSheet.Cells(i, 12).Value = cProps.Item("Jamb").Value
                        oXSheet.Cells(i, 13).Value = cProps.Item("Threshold").Value
                        oXSheet.Cells(i, 14).Value = cProps.Item("SetNo").Value
                     
                        Set cProps = propSet3.Properties
                        
                        oXSheet.Cells(i, 2).Value = cProps.Item("Style").Value
                        oXSheet.Cells(i, 5).Value = cProps.Item("Thickness").Value
                        oXSheet.Cells(i, 5).NumberFormat = "# ?/?"
                        oXSheet.Cells(i, 4).Value = cProps.Item("DoorSize").Value
                        
                        
                        
                
                        
                    
                  End If
            End If
        Next
    'If TypeName(data(i)(ii)) = "String" Then
    '                    xlsWs.Cells(Row + i, col + ii).NumberFormat = "@"
    End Sub
    Code:
    Public Sub PullFromExcel()
    
        Dim oExcel As Excel.Application
        Dim oXWorkbook As Excel.Workbook
        Dim oXSheet As Excel.Worksheet
        
        Set oExcel = GetObject(, "Excel.Application")
        Set oXWorkbook = oExcel.ActiveWorkbook
        Set oXSheet = oXWorkbook.ActiveSheet
        
        Dim ent As AcadEntity
        Dim Door As AecDoor
        Dim schApp As New AecScheduleApplication
        Dim cPropSets As AecSchedulePropertySets
        Dim propSet1 As AecSchedulePropertySet
        Dim propSet2 As AecSchedulePropertySet
        Dim propSet3 As AecSchedulePropertySet
        Dim cProps As AecScheduleProperties
        Dim prop As AecScheduleProperty
        Dim i As Integer
        i = 4
     
        Do
            i = i + 1
            Set ent = ThisDrawing.HandleToObject(oXSheet.Cells(i, 1))
            If Not ent Is Nothing Then
                If TypeOf ent Is AecDoor Then
                    Set Door = ent
                    Set cPropSets = schApp.PropertySets(Door)
                    Set propSet1 = cPropSets.Item("HNTBDoor")
                    Set propSet2 = cPropSets.Item("HNTBFrame")
                    Set propSet3 = cPropSets.Item("HNTBDoorStyles")
                    
                    
                    
                    If Not propSet1 Is Nothing Then
                        Set cProps = propSet1.Properties
                        
                        cProps.Item("DoorNumber").Value = oXSheet.Cells(i, 3).Value
                        cProps.Item("Type").Value = oXSheet.Cells(i, 6).Value
                        cProps.Item("Material").Value = oXSheet.Cells(i, 7).Value
                        cProps.Item("FireRating").Value = oXSheet.Cells(i, 15).Value
                        cProps.Item("Glazing").Value = oXSheet.Cells(i, 8).Value
                        cProps.Item("Remarks").Value = oXSheet.Cells(i, 16).Value
                        cProps.Item("Rev#").Value = oXSheet.Cells(i, 17).Value
                        
                        Set cProps = propSet2.Properties
                        
                        cProps.Item("Type").Value = oXSheet.Cells(i, 9).Value
                        cProps.Item("Material").Value = oXSheet.Cells(i, 10).Value
                        cProps.Item("Head").Value = oXSheet.Cells(i, 11).Value
                        cProps.Item("Jamb").Value = oXSheet.Cells(i, 12).Value
                        cProps.Item("Threshold").Value = oXSheet.Cells(i, 13).Value
                        cProps.Item("SetNo").Value = oXSheet.Cells(i, 14).Value
                        
                    End If
                End If
            End If
        Loop While oXSheet.Cells(i + 1, 1).Value <> ""
        
    End Sub
    Attached Images Attached Images
    Last edited by Opie; 2007-04-24 at 08:56 PM. Reason: [CODE] tags added

Similar Threads

  1. New Excel Data Link
    By Wish List System in forum Revit MEP - Wish List
    Replies: 2
    Last Post: 2014-10-22, 09:48 PM
  2. 2013: Label/tag using excel data
    By arthur.193460 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2014-02-19, 10:21 PM
  3. excel data link
    By miguelcid in forum AutoLISP
    Replies: 6
    Last Post: 2010-10-27, 03:30 PM
  4. Pushing Data or Retreiving from a Central File
    By ronsarlo in forum CAD Management - General
    Replies: 8
    Last Post: 2009-08-05, 09:24 PM
  5. Data tool and Excel
    By rrijswijk104343 in forum NavisWorks - General
    Replies: 10
    Last Post: 2009-06-04, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •