- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I appreciate that this has been answered elsewhere on this forum however these posts haven't helped me. I'm trying to update bar sections (standard UB and UC) in a model with 12,500 bars. I have a table in excel (see table.png below) and want to click the button which runs the following VB code to update the bar sections.
Sub Update_Bars_3()
Application.ScreenUpdating = False
Dim robapp As RobotApplication
Set robapp = New RobotApplication
Dim lab_serv As RobotLabelServer
Set lab_serv = robapp.Project.Structure.Labels
Set myrange = Range(Range("A7"), Range("A7").End(xlDown))
For Each Cell In myange
Dim bar As RobotBar
Dim Bar_Number As Long
Bar_Number = Cell.Value
'Set bar = robapp.Project.Structure.Bars.Get(Bar_Number)
Set bar = Structure.Bars.Get(Bar_Number)
Dim rr_section As String
rr_section = Cell.Offset(0, 3)
bar.SetLabel I_LT_BAR_SECTION, rr_section
Set bar = Nothing
Next Cell
Set robapp = Nothing
Application.ScreenUpdating = True
End SubUnfortunately this gives me a "Runtime error 13, type mismatch" error.
Any help with this would be greatly appreciated.
As a follow on question: do I have to have the UB and UC section already added to the Robot sections dialogue box window in order to update the bar table? Is there an easy way to just update the bar table with any (robot valid) standard UB or UC? Or perhaps using the API I can populate the sections list with all the UBs and UCs?
Many thanks, Rob
Solved! Go to Solution.
