You are on page 1of 3

Sub Examp8()

Dim objOpenSTAAD

Dim EndForces(6) As Double

Dim PrimaryLCs As Integer

Dim LoadCombs As Integer

Dim Depth As Double

Dim Width As Double

Dim MemberNo As Long

Dim MaxSaggingMoment As Double

Dim Ax As Double, Ay As Double, Az As Double, Ix As Double, Iy As Double, Iz As Double

Dim LoadPrevious As Integer

Dim LoadNext As Integer

Dim strLoadName As String

'Launch OpenSTAAD Object

Set objOpenSTAAD = CreateObject("OpenSTAAD.Output.1")

'Load your STAAD file - make sure you have successfully run the file

objOpenSTAAD.SelectSTAADFile Cells(14, 2).Value

MemberNo = Cells(15, 2).Value

'Find out how many primary load cases and load combinations you have

objOpenSTAAD.GetPrimaryLoadCaseCount PrimaryLCs

Cells(2, 10).Value = PrimaryLCs

objOpenSTAAD.GetLoadCombinationCaseCount LoadCombs
Cells(3, 10).Value = LoadCombs

TotalLoads = PrimaryLCs + LoadCombs

'Iterate through your load sets to find the results for each load case

LoadPrevious = 0

For i = 1 To TotalLoads

objOpenSTAAD.GetNextLoadCase LoadPrevious, LoadNext, strLoadName

Cells(2, i + 1).Value = LoadNext

Cells(3, i + 1).Value = strLoadName

objOpenSTAAD.GetMemberEndForces MemberNo, 0, LoadNext, EndForces(0)

For j = 0 To 5

'Print the result values in specified cells

Cells(j + 4, i + 1).Value = EndForces(j)


objOpenSTAAD.GetMinBendingMoment MemberNo, "MZ", LoadNext, MaxSaggingMoment

Cells(10, i + 1).Value = MaxSaggingMoment

LoadPrevious = LoadNext


'Write the appropriate dimensions (for the beam) in the correct cells


'Get Depth and Width of Concrete Beam

'objOpenSTAAD.GetMemberProperties MemberNo, Width, Depth, Ax, Ay, Az, Ix, Iy, Iz

objOpenSTAAD.GetMemberWidthAndDepth MemberNo, Width, Depth


Cells(32, 7).Value = Depth

Cells(31, 7).Value = Width


Set objOpenSTAAD = Nothing

End Sub