Option Explicit
' Declare variables for ETABS API objects
Dim ETABSObject As ETABSv1.cOAPI
Dim SapModel As ETABSv1.cSapModel
' Return values from ETABS functions
Dim ret As Long
' Data arrays
Dim Obj() As String, Elm() As String, LoadCase() As String
Dim StepType() As String, StepNum() As Double
Dim F1() As Double, F2() As Double, F3() As Double
Dim M1() As Double, M2() As Double, M3() As Double
Dim prev_data As Integer
Dim FrameIDs() As String, FrameProp() As String, FrameMatProp() As String
Dim ObjectType As Integer, materialToCheck As String
' Counters and data lengths
Dim NumberItems As Long, NumberNames As Long, NumberResults As Long
' Analysis data
Dim myFile As String, MyName() As String
Dim i As Integer
Dim MyValue() As Double, Value() As Double, Period() As Double
Dim Ux() As Double, Uy() As Double, Uz() As Double
Dim SumUx() As Double, SumUy() As Double, SumUz() As Double
Dim Rx() As Double, Ry() As Double, Rz() As Double
Dim SumRx() As Double, SumRy() As Double, SumRz() As Double
Dim ModalMass() As Double, ModalStiff() As Double
Sub DeleteFramesWalls()
' Variables for file handling
Dim folderPath As String
Dim fileName As String
Dim ret As Long ' Return value for ETABS functions
Dim fd As Office.FileDialog
' Open a FileDialog to select the folder path
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Title = "Select the Folder Containing ETABS Files"
If .Show = True Then
folderPath = .SelectedItems(1) & "\"
Else
' Exit the sub if no folder is selected
MsgBox "No folder selected. Exiting..."
Exit Sub
End If
End With
' Get the first ETABS file (*.EDB) in the selected folder
fileName = Dir(folderPath & "*.EDB")
' Loop through each ETABS file in the directory
Do While fileName <> ""
' Create and start an instance of the ETABS application
Set ETABSObject = CreateObject("CSI.ETABS.API.ETABSObject")
ret = ETABSObject.ApplicationStart()
' Initialize and load the model
Set SapModel = ETABSObject.SapModel
ret = SapModel.InitializeNewModel()
ret = SapModel.File.OpenFile(folderPath & fileName)
' Select a specific group for operations
ret = SapModel.SelectObj.Group("Grouprvr")
' Set units to kN-m for consistency in operations
ret = SapModel.SetPresentUnits(6)
' Clean up and prepare for the next file
Set SapModel = Nothing
Set ETABSObject = Nothing
fileName = Dir() ' Move to the next file
Loop
' Optional: Close the ETABS application
' ETABSObject.ApplicationExit False
End Sub