Advertisement

07.27.2007 at 02:06PM PDT, ID: 22725451
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Taking Excel file and uploading ADT 2007 Schedule

Asked by stephenlecomptejr in CAD & Architecture Software, AutoCAD Software

Tags: , ,

I've got an Excel file that I'm trying to load information back to an ADT 2007 schedule called FKP_OpeningObjects.  For some reason I get a run-time error '-2147467259 (80004005)':
Method 'Value' of object 'IAecScheduleProperty' failed
With options to click on OK or Help.
and the highlight yellow does not appear anywhere on a specific line item that is causing the error.

Using the VBA Manager - I have the following function that tries this called PullfromExcel...

Public Sub PullFromExcel()
'On Error GoTo Err_This

Dim i As Integer
Dim sFileName As String
sFileName = "C:\temp\test.xls"
Set oExcel = CreateObject("Excel.Application")
Set oXWorkbook = oExcel.Workbooks.Open(sFileName)
Set oXSheet = oXWorkbook.Worksheets(1)
Debug.Print oXSheet.Cells(1, 1)
oExcel.Visible = True

Dim ent As AcadEntity
Dim door As AecDoor
Dim schApp As New AecScheduleApplication
Dim cPropSets As AecSchedulePropertySets
Dim propSet As AecSchedulePropertySet
Dim cProps As AecScheduleProperties
Dim prop As AecScheduleProperty

i = 2
  For Each ent In ThisDrawing.ModelSpace
    If TypeOf ent Is AecDoor Then
      Set door = ent
      Set cPropSets = schApp.PropertySets(door)
      Set propSet = cPropSets.Item("FKP_OpeningObjects")
      If Not propSet Is Nothing Then
        Set cProps = propSet.Properties
        i = i + 1
        'cProps.Item("OpeningName").Value = oXSheet.Cells(i, 1)
        'cProps.Item("OpeningNumber").Value = oXSheet.Cells(i, 2)
        'cProps.Item("SuffixNumber").Value = oXSheet.Cells(i, 3)
        'cProps.Item("DoorType").Value = oXSheet.Cells(i, 4)
        'cProps.Item("OpeningMaterial").Value = oXSheet.Cells(i, 5)
        'cProps.Item("FrameType").Value = oXSheet.Cells(i, 6)
        'cProps.Item("Material").Value = oXSheet.Cells(i, 7)
        'cProps.Item("Hardware").Value = oXSheet.Cells(i, 8)
        'cProps.Item("FireRating").Value = oXSheet.Cells(i, 9).Value
        'cProps.Item("ElevationType").Value = oXSheet.Cells(i, 10)
        'cProps.Item("TypicalRemarks").Value = oXSheet.Cells(i, 11).Value
        Debug.Print "Excel value: " '& the exact syntax code for the Excel value
        Debug.Print " = AutoCAD value: "  '& the exact syntax code for the AutoCAD value
        Debug.Print
      End If
    End If
  Next
 
Now the other set of code:  PushtoExcel works the opposite (by taking the schedule and creating an Excel file) and works great without any problems.  This allows me to create an Excel file based on the data in the AutoCAD schedule but I'm just scratching my head in how I can load back my new values to the AutoCAD schedule?

Public Sub PushToExcel()

Call CloseExcel

Set oExcel = CreateObject("Excel.Application")
Set oXWorkbook = oExcel.Workbooks.Add
Set oXSheet = oXWorkbook.Sheets(1)
oExcel.Visible = True

Dim ent As AcadEntity
Dim door As AecDoor
Dim schApp As New AecScheduleApplication
Dim cPropSets As AecSchedulePropertySets
Dim propSet As AecSchedulePropertySet
Dim cProps As AecScheduleProperties
Dim prop As AecScheduleProperty
Dim i As Integer
i = 1

oXSheet.Cells(1, 1).Value = "OpeningName"
oXSheet.Cells(1, 2).Value = "OpeningNumber"
oXSheet.Cells(1, 3).Value = "SuffixNumber"
oXSheet.Cells(1, 4).Value = "Size"
oXSheet.Cells(1, 5).Value = "DoorType"
oXSheet.Cells(1, 6).Value = "OpeningMaterial"
oXSheet.Cells(1, 7).Value = "FrameType"
oXSheet.Cells(1, 8).Value = "Material"
oXSheet.Cells(1, 9).Value = "Hardware"
oXSheet.Cells(1, 10).Value = "FireRating"
oXSheet.Cells(1, 11).Value = "ElevationType"
oXSheet.Cells(1, 12).Value = "TypicalRemarks"
oXSheet.Cells(1, 13).Value = "Object ID"


For Each ent In ThisDrawing.ModelSpace
If TypeOf ent Is AecDoor Then
Set door = ent
Set cPropSets = schApp.PropertySets(door)
Set propSet = cPropSets.Item("FKP_OpeningObjects")
If Not propSet Is Nothing Then
Set cProps = propSet.Properties
i = i + 1
oXSheet.Cells(i, 1).Value = cProps.Item("OpeningName").Value
oXSheet.Cells(i, 2).Value = cProps.Item("OpeningNumber").Value
oXSheet.Cells(i, 3).Value = cProps.Item("SuffixNumber").Value
oXSheet.Cells(i, 4).Value = cProps.Item("Size").Value
oXSheet.Cells(i, 5).Value = cProps.Item("Doortype").Value
oXSheet.Cells(i, 6).Value = cProps.Item("OpeningMaterial").Value
oXSheet.Cells(i, 7).Value = cProps.Item("FrameType").Value
oXSheet.Cells(i, 8).Value = cProps.Item("Material").Value
oXSheet.Cells(i, 9).Value = cProps.Item("Hardware").Value
oXSheet.Cells(i, 10).Value = cProps.Item("FireRating").Value
oXSheet.Cells(i, 11).Value = cProps.Item("ElevationType").Value
oXSheet.Cells(i, 12).Value = cProps.Item("TypicalRemarks").Value
oXSheet.Cells(i, 13).Value = cProps.Item("ObjectID").Value

End If
End If
Next

End Sub

Public Sub CloseExcel()
On Error Resume Next

  Set oExcel = Nothing
  Set oXWorkbook = Nothing
  Set oXSheet = Nothing
   
End SubStart Free Trial
[+][-]08.02.2007 at 01:23PM PDT, ID: 19620538

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: CAD & Architecture Software, AutoCAD Software
Tags: adt, excel, file
Sign Up Now!
Solution Provided By: dragontooth
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.19.2007 at 04:26PM PDT, ID: 19925222

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32