0% found this document useful (0 votes)
168 views2 pages

Staad - Pro Vba

This VBA code opens a STAAD file, runs the analysis, and extracts member intermediate forces at different distances along each member for different load cases. It stores the distance, axial force, shear force 1, and bending moment values in cells of the active Excel worksheet. The code loops through 7 members, 3 load cases, and distance increments along each member to retrieve the member forces from STAAD and output them to the worksheet.

Uploaded by

piv0ter_better
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views2 pages

Staad - Pro Vba

This VBA code opens a STAAD file, runs the analysis, and extracts member intermediate forces at different distances along each member for different load cases. It stores the distance, axial force, shear force 1, and bending moment values in cells of the active Excel worksheet. The code loops through 7 members, 3 load cases, and distance increments along each member to retrieve the member forces from STAAD and output them to the worksheet.

Uploaded by

piv0ter_better
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Private Sub CommandButton1_Click()

Dim objOpenSTAAD As Object


Dim name As String
Dim fname As String
Dim ostaad As String
Dim mno(7) As Long
Dim dw As Double
Dim db1 As Double
Dim db2 As Double
Dim j As Double
Dim k As Double
Dim dist(0 To 6) As Double
Dim loadcase(7 To 9) As Long
Dim FA(0 To 5) As Double
Dim x As Integer

dw = Sheets("LOAD_EP").Range("a19")
db1 = Sheets("LOAD_EP").Range("c25")
db2 = Sheets("LOAD_EP").Range("e25")

For i = 1 To 7
mno(i) = i
Next i

For g = 7 To 9
loadcase(g) = g
Next g
x = 0
fname = InputBox("Enter name of the staad file with extension .std")

name = Application.ActiveWorkbook.Path & "\" & fname

'open staad pro


ostaad = "C:\SProV8i SS6\STAAD\Staadpro.exe"

ActiveWorkbook.FollowHyperlink ostaad

'Get the application object


Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")
'Open the file
objOpenSTAAD.OpenSTAADFile name
'run analysis
objOpenSTAAD.analyze

'Get Member Intermediate Forces


For i = 1 To 7
If i = 1 Or i = 3 Then
j = db1
End If
If i = 2 Or i = 4 Then
j = db2
End If
If i = 5 Or i = 6 Or i = 7 Then
j = dw
End If
For g = 0 To 6
dist(g) = g * j / 6
Next g
For l = 7 To 9
For k = 0 To 6
objOpenSTAAD.Output.GetIntermediateMemberForcesAtDistance mno(i), dist(k),
loadcase(l), FA

Cells((143 + x), 3) = dist(k)


Cells((143 + x), 4) = FA(0)
Cells((143 + x), 5) = FA(1)
Cells((143 + x), 6) = FA(5)
x = x + 1

Next k
Next l
Next i

Set objOpenSTAAD = Nothing

MsgBox "Member forces extracted"

End Sub

You might also like