Sie sind auf Seite 1von 12

Module1 - 1

Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

RamDataAcc1 As RAMDATAACCESSLib.RamDataAccess1
RamDataAccIDBIO As RAMDATAACCESSLib.IDBIO1
IModel As RAMDATAACCESSLib.IModel
ISteelCriteria As RAMDATAACCESSLib.ISteelCriteria
IModelData1 As RAMDATAACCESSLib.IModelData1
IStories As RAMDATAACCESSLib.IStories
IStory As RAMDATAACCESSLib.IStory
IBeams As RAMDATAACCESSLib.IBeams
IBeam As RAMDATAACCESSLib.IBeam

Dim IColumns As RAMDATAACCESSLib.IColumns


Dim IColumn As RAMDATAACCESSLib.IColumn
Dim IHBraces As RAMDATAACCESSLib.IHorizBraces
Dim IHBrace As RAMDATAACCESSLib.IHorizBrace
Dim IVBraces As RAMDATAACCESSLib.IVerticalBraces
Dim IVBrace As RAMDATAACCESSLib.IVerticalBrace
Dim IReactionNodes As RAMDATAACCESSLib.IReactionNodes
Dim IReactionNode As RAMDATAACCESSLib.IReactionNode
Dim IProperties As RAMDATAACCESSLib.IProperties
Dim IProperty As RAMDATAACCESSLib.IProperty
Dim ISteelBeamDesignResult As RAMDATAACCESSLib.ISteelBeamDesignResult
Dim prop As Props
Dim
Dim
Dim
Dim

pStartPoint As RAMDATAACCESSLib.SCoordinate
pEndPoint As RAMDATAACCESSLib.SCoordinate
dVersion As Double
dVMin As Double

'Long
Dim R As Long
Dim lNumMems As Long
Dim lNumStories As Long
Dim lStory As Long
Dim lMem As Long
Dim lNumCants As Long
Dim lMemberID As Double
Dim plNumStudSegments As Long
Dim lSizeOfArrayOfStuds As Long
Dim lTotalStuds As Long
Dim lStudSeg As Long
Dim i As Long
Dim lNumPoints As Long
Dim lPoint As Long
Dim lStoryUID As Long
Dim NumFinalPolygons As Long
Dim lFinalPolygon As Long
Dim NumFinalDiaphragms As Long
Dim lHole As Long
Dim lFirstSpace As Long
Dim j As Long
Dim lNumWebOpenings As Long
Dim lBasePlate As Long
Dim lFixity As Long
Dim lAboveUID As Long
Dim lSplice As Long
Dim lLoadDB As Long
Dim palNumStuds() As Long
'Double
Dim dMemLength As Double
Dim pdArea As Double
Dim pdBfTop As Double
Dim pdBfBot As Double

Module1 - 2
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

pdTfTop As Double
pdTfBot As Double
pdDepth As Double
pdWebT As Double
dSectionPerimeter As Double
dX1 As Double
dY1 As Double
dZ1 As Double
dX2 As Double
dY2 As Double
dZ2 As Double
dPerimeterLength As Double
dConcThick As Double
dPolygonArea As Double
dHoleArea As Double
dP1X As Double
dP2X As Double
dP3X As Double
dP1Y As Double
dP2Y As Double
dP3Y As Double
dP1Z As Double
dP2Z As Double
dP3Z As Double
dP1P2 As Double
dP2P3 As Double
dP1P3 As Double
dTemp As Double
dWeight As Double
dUnitsFactor As Double
dDesignCamber As Double

Dim
Dim
Dim
Dim
Dim
Dim

A As Double
B As Double
c As Double
dAngle As Double
dM1 As Double
dM2 As Double

'Enumerators
Dim eBeamCoordLoc As eBeamCoordLoc
Dim peBeamStatus As model_status
Dim peColumnStatus As model_status
Dim peFrameStatus As model_status
Dim peShape As ESTEEL_SEC
'Strings
Dim frameType As String
Type Props
strDesig As String
strRollFlg As String
dDepth As Double
dTw As Double
dBfTop As Double
dTfTop As Double
dBfBot As Double
dTfBot As Double
dKTop As Double
dKBot As Double
dArea As Double
dPerimeter As Double
strShape As String
End Type
Private Function GetSectionProps() As Props
Dim SectionProps As Props
Set IMemberData1 = RamDataAcc1.GetDispInterfacePointerByEnum(IMemberData_INT)
IMemberData1.GetSteelMemberSectionDimProps lMemberID, peShape, 1, pdBfTop, pdBfBot, pdTfTop, pdTfB
ot, 1, 1, pdDepth, pdWebT, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, pdArea

Module1 - 3
If peShape = EStlWF Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth + 2 * pdBfBot - 2 * pdWebT
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "ISection"
End If
If peShape = EStlChannel Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth + 2 * pdBfBot - 2 * pdWebT
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "Channel"
End If
If peShape = EStlTube Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth
SectionProps.dBfTop = pdBfTop
SectionProps.strShape = "Tube"
End If
If peShape = EStlDoubleL Then
SectionProps.dArea = 2 * pdArea
SectionProps.dPerimeter = 4 * pdDepth + 4 * pdWebT
SectionProps.dBfTop = 0
SectionProps.strShape = "DoubleAngle"
End If
If peShape = EStlFlatBar Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdBfTop * 2 + pdTfTop * 2
SectionProps.dBfTop = 0
SectionProps.strShape = "Bar"
End If
If peShape = EStlLSection Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdDepth + 2 * pdWebT
SectionProps.dBfTop = 0
SectionProps.strShape = "Angle"
End If
If peShape = EStlNone Then
SectionProps.dArea = 0
SectionProps.dPerimeter = 0
SectionProps.dBfTop = 0
SectionProps.strShape = "NA"
End If
If peShape = EStlPipe Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdDepth * 3.14159
SectionProps.dBfTop = 0
SectionProps.strShape = "Pipe"
End If
If peShape = EstlRoundBar Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = pdDepth * 3.14159
SectionProps.dBfTop = 0
SectionProps.strShape = "Rod"
End If
If peShape = EStlTSection Then
SectionProps.dArea = pdArea
SectionProps.dPerimeter = 2 * pdBfTop + 2 * pdDepth
SectionProps.dBfTop = 0
SectionProps.strShape = "Tee"
End If
GetSectionProps = SectionProps
End Function

Sub runThis()
' Define Variables
'Set version developed
dVMin = 14.5

Module1 - 4
'Get Model path
OpenFile = Application.GetOpenFilename("RAM SS Database (*.ram; *.rss), *.ram; *.rss")
If OpenFile = "" Or OpenFile = False Then
Exit Sub
End If
'Initialize DataAccess
Set RamDataAcc1 = New RAMDATAACCESSLib.RamDataAccess1
'Set RamDataAcc1 = CreateObject("RAMDATAACCESSLib.RamDataAccess1")
'Initialize IO interface
Set RamDataAccIDBIO = RamDataAcc1.GetDispInterfacePointerByEnum(IDBIO1_INT)
'Check to see if compatible version
RamDataAccIDBIO.GetDatabaseVersion OpenFile, dVersion
dVersion = Round(dVersion, 1)
If dVersion < dVMin Then
strVMin = dVMin
MsgBox "This tool was written for Ram Structural System version " + strVMin + " or later.
ase update."
Exit Sub
End If

Ple

lLoadDB = RamDataAccIDBIO.LoadDataBase2(OpenFile, "DA")


If lLoadDB <> 0 Then
MsgBox "The model appears to be in use or is not consistent with the version of RAM Structural
System on this machine."
Exit Sub
End If
'Initialize the Object Model Interface
Set IModel = RamDataAcc1.GetDispInterfacePointerByEnum(IModel_INT)
' get Storeis
Set IStories = IModel.GetStories
iNumStories = IStories.GetCount
ClearTable "outputTbl"
ClearTable "columnsTbl"
ClearTable "hbracesTbl"
ClearTable "vbracesTbl"
ClearTable "framereactionnodesTbl"
ClearTable "gravityreactionnodesTbl"
Set IStory = IStories.GetAt(0)
strStoryID = IStory.strLabel
'Dim IReactionNodes As IReactionNodes
'Dim IreactionNode As IreactionNode
Dim ILoadCases As ILoadCases
Dim ILoadCase As ILoadCase
Dim IPointLoad As IPointLoad
Set ILoadCases = IModel.GetLoadCases(RAMFrameResultType)
'Set ILoadCases = IModel.GetLoadCases(DefaultResultType)
'set loadcombo = IModel.GetLoadCombinations(E
'ILoadCases.Filter eLoadCaseFilter_GeneratesDesignForces, True
LoadCaseCount = ILoadCases.GetCount
Dim c As Integer
c = 0
For lLc = 0 To (LoadCaseCount - 1)
Set ILoadCase = ILoadCases.GetAt(lLc)
strSymbol = ILoadCase.strLoadCaseGroupLabel
'If ILoadCase.eAnalyzedState = eStateCurrent And ILoadCase.eLdCaseMergeState = eSingleLoadCase The
n
'IStory.GetMemberReactionNodesFromFloorBelow
c = c + 1
Dim INodes As INodes
Set INodes = IModel.GetFrameAnalysisNodes
InodeCount = INodes.GetCount
Dim INode As INode

Module1 - 5
INodes.Filter eNFilter_AtFoundation, True
InodeCount = INodes.GetCount
Dim IMemberForces As IMemberForces
Dim IMemberForce As IMemberForce
For t = 0 To (InodeCount - 1)
Set INode = INodes.GetAt(t)
Set IMemberForces = INode.GetReactions
Set IMemberForce = IMemberForces.Get(ILoadCase.lUID)
Dim reactDict As New dictionary
'reactDict.Add "Floor", strStoryID
'reactDict.Add "c", ILoadCase.eLoadType
'reactDict.Add "d", ILoadCase.GetPrimaryLoadCases.GetCount
'reactDict.Add "e", ILoadCase.lUID
'reactDict.Add "lc", ILoadCase.lSubLoadType
reactDict.Add "LoadCaseSymbol", strSymbol
reactDict.Add "LoadCase", ILoadCase.strTypeLabel
reactDict.Add "FZ", IMemberForce.dAxial
reactDict.Add "FX", IMemberForce.dShearMajor
reactDict.Add "FY", IMemberForce.dShearMinor
reactDict.Add "MXX", IMemberForce.dMomentMajor
reactDict.Add "MYY", IMemberForce.dMomentMinor
reactDict.Add "MZZ", IMemberForce.dTorsion
reactDict.Add "X", INode.sLocation.dXLoc
reactDict.Add "Y", INode.sLocation.dYLoc
reactDict.Add "Z", INode.sLocation.dZLoc
reactDict.Add "uniqueNodeID", INode.lUniqueID
AddToTable reactDict, "framereactionnodesTbl"
Set reactDict = Nothing
Next
'Set IStory = IStories.GetAt(1)
'Dim IRnds As IReactionNodes
'Dim IRnd As IreactionNode
'Dim someNodes As INodes
'Set someNodes = IStories.GetAt(3).GetIsolatedFnds.GetAt(1)
'IReactionNodes.Filter eRNFilterAtFoundation, True
'ICount = someNodes.GetCount
'Set some = abc.GetAt(0)
'For
'
'
'
'

j =
Set
Set
Set

0 To (irNodeCount - 1)
IRnd = IRnds.GetAt(0)
IMemberForces = IRnd.GetReactions(eFMFSGravityAnalysis)
IMemberForce = IMemberForces.Get(ILoadCase.lUID)

Dim graVreactDict As New dictionary


'reactDict.Add "Floor", strStoryID
'reactDict.Add "c", ILoadCase.eLoadType
'reactDict.Add "d", ILoadCase.GetPrimaryLoadCases.GetCount
'reactDict.Add "e", ILoadCase.lUID
'reactDict.Add "lc", ILoadCase.lSubLoadType

'
'
'
'
'
'
'
'
'
''
'
'
''
'
'Next

graVreactDict.Add "LoadCaseSymbol", strSymbol


graVreactDict.Add "LoadCase", ILoadCase.strTypeLabel
graVreactDict.Add "FZ", IMemberForce.dAxial
graVreactDict.Add "FX", IMemberForce.dShearMajor
graVreactDict.Add "FY", IMemberForce.dShearMinor
graVreactDict.Add "MXX", IMemberForce.dMomentMajor
graVreactDict.Add "MYY", IMemberForce.dMomentMinor
graVreactDict.Add "MZZ", IMemberForce.dTorsion
graVreactDict.Add "X", INode.sLocation.dXLoc
graVreactDict.Add "Y", INode.sLocation.dYLoc
graVreactDict.Add "Z", INode.sLocation.dZLoc
reactDict.Add "uniqueNodeID", INode.lUniqueID
AddToTable graVreactDict, "gravityreactionnodesTbl"
Set graVreactDict = Nothing

Module1 - 6

'End If
'ReactionNodeCount = IReactionNodes.GetCount
' For lReact = 0 To (ReactionNodeCount - 1)
'
Set IReactionNode = IReactionNodes.GetAt(lReact)
'
Set IPointLoad = IReactionNode.GetReaction(eFMFSFrameAnalysis, ILoadCase.lAnalyzeNo)
'
Dim reactDict As dictionary
'
reactDict.Add "Floor", strStoryID
'
reactDict.Add "LoadCaseSymbol", strSymbol
'
reactDict.Add "dFx", IPointLoad.dFx
'
reactDict.Add "dFy", IPointLoad.dFy
''
reactDict.Add "dFz", IPointLoad.dFz
'
reactDict.Add "mFx", IPointLoad.mFx
'
reactDict.Add "mFy", IPointLoad.mFy
'
reactDict.Add "mFz", IPointLoad.mFz
'
AddToTable reactDict, "reactionnodesTbl"
'
Set reactDict = Nothing

'Next
Next

For lStory = 0 To (iNumStories - 1)


Set IStory = IStories.GetAt(lStory)
strStoryID = IStory.strLabel
'IModel.GetLoadCombinations (STEEL_CUSTOM).GetAt(1).CalculateForce(
' columns code
Set IColumns = IStory.GetColumns
IColumns.Filter eColFilter_Material, ESteelMat
lNumColumns = IColumns.GetCount
Dim lColumn As Long
For lColumn = 0 To lNumColumns - 1
Set IColumn = IColumns.GetAt(lColumn)
lMemberID = IColumn.lUID
member_num = IColumn.lLabel
' If member_num = 1 Then
sect_lbl = IColumn.strSectionLabel
prop = GetSectionProps
IColumn.GetEndCoordinates pStartPoint, pEndPoint
dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY
Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)
'IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
If IColumn.eFramingType = MemberIsGravity Then
frameType = "Gravity"
ElseIf IColumn.eFramingType = MemberIsLateral Then
frameType = "Lateral"
End If
Dim colDict As New dictionary
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add
colDict.Add

"Floor", strStoryID
"ColumnNo", member_num
"FrameType", frameType
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc

Module1 - 7
colDict.Add "StartY", pStartPoint.dYLoc
colDict.Add "StartZ", pStartPoint.dZLoc
colDict.Add "EndX", pEndPoint.dXLoc
colDict.Add "EndY", pEndPoint.dYLoc
colDict.Add "EndZ", pEndPoint.dZLoc
AddToTable colDict, "columnsTbl"
Set colDict = Nothing
Next
'hbrace code starts
Set IHBraces = IStory.GetHorizBraces
IHBraces.Filter eColFilter_Material, ESteelMat
lNumHbraces = IHBraces.GetCount
Dim lHbrace As Long
For lHbrace = 0 To lNumHbraces - 1
Set IHBrace = IHBraces.GetAt(lHbrace)
lMemberID = IHBrace.lUID
member_num = IHBrace.lLabel
' If member_num = 1 Then
sect_lbl = IHBrace.strSectionLabel
prop = GetSectionProps
IHBrace.GetEndCoordinates pStartPoint, pEndPoint
dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY
Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)
'IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
'If IColumn.eFramingType = MemberIsGravity Then
'
frameType = "Gravity"
' ElseIf IColumn.eFramingType = MemberIsLateral Then
'
frameType = "Lateral"
' End If
Dim hbraceDict As New dictionary
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add
hbraceDict.Add

"Floor", strStoryID
"ColumnNo", member_num
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc
"StartY", pStartPoint.dYLoc
"StartZ", pStartPoint.dZLoc

hbraceDict.Add "EndX", pEndPoint.dXLoc


hbraceDict.Add "EndY", pEndPoint.dYLoc
hbraceDict.Add "EndZ", pEndPoint.dZLoc
AddToTable hbraceDict, "hbracesTbl"
Set hbraceDict = Nothing
Next
'vbrace code ends
'vbrace code starts
Set IVBraces = IStory.GetVerticalBraces
IVBraces.Filter eColFilter_Material, ESteelMat
lNumvbraces = IVBraces.GetCount
Dim lvbrace As Long
For lvbrace = 0 To lNumvbraces - 1
Set IVBrace = IVBraces.GetAt(lvbrace)
lMemberID = IVBrace.lUID
member_num = IVBrace.lLabel
' If member_num = 1 Then

Module1 - 8
sect_lbl = IVBrace.strSectionLabel
prop = GetSectionProps
IVBrace.GetEndCoordinates pStartPoint, pEndPoint
dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY
Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)
'IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
'If IColumn.eFramingType = MemberIsGravity Then
'
frameType = "Gravity"
' ElseIf IColumn.eFramingType = MemberIsLateral Then
'
frameType = "Lateral"
' End If
Dim vbraceDict As New dictionary
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add
vbraceDict.Add

"Floor", strStoryID
"ColumnNo", member_num
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"ColumnLength", dMemLength
"StartX", pStartPoint.dXLoc
"StartY", pStartPoint.dYLoc
"StartZ", pStartPoint.dZLoc

vbraceDict.Add "EndX", pEndPoint.dXLoc


vbraceDict.Add "EndY", pEndPoint.dYLoc
vbraceDict.Add "EndZ", pEndPoint.dZLoc
AddToTable vbraceDict, "vbracesTbl"
Set vbraceDict = Nothing
Next
'vbrace code ends

'Get member ID lists on Story


Set IBeams = IStory.GetBeams
IBeams.Filter eBeamFilter_Material, ESteelMat
lNumBeams = IBeams.GetCount
Dim lBeam As Long
For lBeam = 0 To lNumBeams - 1

Set IBeam = IBeams.GetAt(lBeam)


lMemberID = IBeam.lUID
member_num = IBeam.lLabel
' If member_num = 1 Then
sect_lbl = IBeam.strSectionLabel
camber = IBeam.dCamber
prop = GetSectionProps
IBeam.GetCoordinates eBeamEnds, pStartPoint, pEndPoint
Set ISteelBeamDesignResult = IBeam.GetSteelDesignResult
Dim numStudsDAArray As RAMDATAACCESSLib.DAArray
Set numStudsDAArray = ISteelBeamDesignResult.GetNumStudsInSegments
Dim designedCamber
Dim pSize As Long
' determin frame type

Module1 - 9
If IBeam.eFramingType = MemberIsGravity Then
frameType = "Gravity"
If IBeam.bComposite = 1 Then
ReDim palNumStuds(0 To 4) As Long
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetSize pSize
For lStudSeg = 0 To pSize - 1
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetAt lStudSeg, k
lTotalStuds = lTotalStuds + k
palNumStuds(lStudSeg) = k
Next
For onWards = pSize To UBound(palNumStuds)
palNumStuds(onWards) = 0
Next
Else
lTotalStuds = 0
End If
ElseIf IBeam.eFramingType = MemberIsLateral Then
frameType = "Lateral"
If IBeam.bComposite = 1 Then
ReDim palNumStuds(0 To 4) As Long
lTotalStuds = 0
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetSize pSize
For lStudSeg = 0 To pSize - 1
IBeam.GetSteelDesignResult.GetNumStudsInSegments.GetAt lStudSeg, k
lTotalStuds = lTotalStuds + k
palNumStuds(lStudSeg) = k
Next
For onWards = pSize To UBound(palNumStuds)
palNumStuds(onWards) = 0
Next
Else
lTotalStuds = 0
End If
End If

dMemLength = Sqr((pStartPoint.dXLoc - pEndPoint.dXLoc) ^ 2 + (pStartPoint.dYLoc - pEndPoint.dY


Loc) ^ 2 + (pStartPoint.dZLoc - pEndPoint.dZLoc) ^ 2)

Dim dict As New scripting.dictionary


dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add

"Floor", strStoryID
"BeamNo", member_num
"FrameType", frameType
"SectionLbl", sect_lbl
"SectionShp", prop.strShape
"SectArea", prop.dArea
"SectTop", prop.dBfTop
"SectPerimeter", prop.dPerimeter
"BeamLength", dMemLength

Module1 - 10
dict.Add "StartX", pStartPoint.dXLoc
dict.Add "StartY", pStartPoint.dYLoc
dict.Add "StartZ", pStartPoint.dZLoc
dict.Add "EndX", pEndPoint.dXLoc
dict.Add "EndY", pEndPoint.dYLoc
dict.Add "EndZ", pEndPoint.dZLoc
dict.Add "Camber", IBeam.dCamber
dict.Add "StudDiameter", IBeam.dStudDiameter
dict.Add "StudLength", IBeam.dStudLength
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add
dict.Add

"StudSegmentLength1", IBeam.dStudSegment1Length
"StudSegmentLength2", IBeam.dStudSegment2Length
"StudSegmentLength3", IBeam.dStudSegment3Length
"StudSegmentLength4", IBeam.dStudSegment4Length
"StudSegmentLength5", IBeam.dStudSegment5Length
"NumOfStud1", palNumStuds(0)
"NumOfStud2", palNumStuds(1)
"NumOfStud3", palNumStuds(2)
"NumOfStud4", palNumStuds(3)
"NumOfStud5", palNumStuds(4)

AddToTable dict, "outputTbl"


Set dict = Nothing
'End If

Next
Next
'For Each ws In ThisWorkbook.Worksheets
'
For Each lstobj In ws.ListObjects
'
If lstobj.Name = "outputTbl" Then
'
lstobj.ListColumns(1).Delete
'
End If
'
Next
'Next
RamDataAccIDBIO.CloseDatabase

End Sub
Sub ClearTable(tblName)
Dim lo As ListObject
For Each ws In ThisWorkbook.Worksheets
For Each lstobj In ws.ListObjects
If lstobj.Name = tblName Then
lstobj.Delete
Set lo = ws.ListObjects.Add(xlSrcRange, ws.Range("$A$4"), , xlYes)
lo.Name = tblName
lo.ListRows.Add AlwaysInsert:=True
End If
Next
Next
'Dim wsh As Worksheet
'Set wsh = ThisWorkbook.Worksheets(1)
'Set lo = wsh.ListObjects.Add(xlSrcRange, Range("$A$4"), , xlYes)
'lo.Name = "outputTbl"
'lo.ListRows.Add AlwaysInsert:=True
End Sub

Module1 - 11
Sub AddToTable(dict As scripting.dictionary, tblName)
Dim
Dim
Dim
Dim

wkBk As Workbook
wksht As Worksheet
lo As ListObject
lstobj As ListObject

Set wkBk = Application.ThisWorkbook


For Each ws In ThisWorkbook.Worksheets
For Each lstobj In ws.ListObjects
If lstobj.Name = tblName Then
AddDictToTbl lstobj, dict
End If
Next
Next

End Sub
Public Function DoesTableExist(ByVal wb As Workbook, _
ByVal tblName As String) As Boolean
On Error GoTo catch
DoesTableExist = False
Dim lstobj As ListObject, ws As Worksheet
For Each ws In wb.Worksheets
For Each lstobj In ws.ListObjects
If lstobj.Name = tblName Then
DoesTableExist = True
Exit Function
End If
Next
Next
Exit Function
catch:
DoesTableExist = False
End Function
Public Function AddDictToTbl(lo As ListObject, dict As scripting.dictionary)
Dim hr As Range
Set hr = lo.HeaderRowRange
For Each k In dict.Keys
If Application.WorksheetFunction.CountIf(hr, k) > 0 Then
Else
lo.ListColumns.Add
lo.HeaderRowRange.End(xlToRight) = k
End If
Next
'lo.ListColumns("Column1").Delete
Dim rowRng As ListRow
'lo.ListRows.Add AlwaysInsert:=True
Set rowRng = lo.ListRows(lo.ListRows.Count)
Dim colRng As Range
Dim tarRng As Range
For Each Key In dict.Keys
' find column no from key
Set colRng = lo.ListColumns(Key).Range

Module1 - 12
Set tarRng = colRng(lo.ListRows.Count + 1)
tarRng = dict(Key)
Next
lo.ListRows.Add AlwaysInsert:=True
If HeaderExists(lo, "Column1") Then
lo.ListColumns("Column1").Delete
End If
End Function
Public Function HeaderExists(tbl As ListObject, HeaderName As String) As Boolean
'PURPOSE: Output a true value if column name exists in specified table
'SOURCE: www.TheSpreadsheetGuru.com
Dim hdr As ListColumn
On Error GoTo DoesNotExist
Set hdr = tbl.ListColumns(HeaderName)
On Error GoTo 0
HeaderExists = True
Exit Function
'Error Handler
DoesNotExist:
Err.Clear
HeaderExists = False
End Function

Das könnte Ihnen auch gefallen