Openstaad(VBA) function is not working

Hello all,

I`m trying to retrieve LX,LY,LZ Design parameters by Openstaad.

But the Design.GetMemberDesignParameters function is not working.

I dont know how the LPDISPATCH works.

Please tell me how I can use the function of GetMemberDesignParameters to get information about steel design parameters like LX,LY,LZ.


Openstaad HELP in Connect Edition

long OSDesignUI::GetMemberDesignParameters  ( long  nBriefRef,  long  nMemberNo, LPDISPATCH  pDesignParams)  

Returns the design parameters for specified member in specified design brief.



[in] nBriefRef The Design Brief reference ID. 

[in] nMemberNo Member number ID. 

[out] pDesignParams Design parameters:[Name, Value, Unit, Description, Default].


VBA Syntax

' Get design parameters defined in Design Brief #1 for member #2.Dim RetVal As long = OSDesignUI.GetMemberDesignParameters(1, 2, &pDesignParams)


I tried like this but not working..


Dim OS As Object
Set OS = GetObject(, "StaadPro.OPenSTAAD")

Dim pDesignParams As Object       'I tried this as string or double but not worked either

RetVal = OS.Design.GetMemberDesignParameters(1, 2, pDesignParams)

msgbox RetVal

end sub

  • Hi Jeong,

    Sorry for the delay. Please find code snippet on the usage of the above API.

    '#Reference {EDA9FA7F-EFC9-4264-9513-39CF6E72604D}#1.0#0#C:\SPro CE\STAAD\StaadPro.dll#OpenSTAADUI#OpenSTAADUI
    Option Explicit

        Sub Main
            Dim objOpenStaad As OpenSTAAD
            Dim stdFile As String

            Set objOpenStaad = GetObject(,"StaadPro.OpenSTAAD")
            objOpenStaad.GetSTAADFile stdFile, "TRUE"
            If stdFile="" Then
                Set objOpenStaad = Nothing
                Exit Sub
            End If

            Dim params As IOSMemberSteelDgnParams

            Set params = CreateObject("StaadPro.MembSteelDgnParams")

            objOpenStaad.Design.GetMemberDesignParameters 0, 2, params

            'MsgBox ("The Member Number is " & params.MemberNumber) -------------> this does not work
            MsgBox ("Total Parameter Count is " & params.Count)

            ' you can loop through all the params, here only accessing the 2nd index of the array
            MsgBox ("The Value of Parameter " & params.Name(2) & " is " & params.Value(2))
            MsgBox"Macro Ending"
            Set objOpenStaad = Nothing
        End Sub

    We are in the process to redesign our manual, till then feel free to get in touch if you face any issues.



    Rudra Lahiri

    Senior Principal Software Engineer, Structural


  • I have the same question and am still unable to get this API to work. Specifically I am trying to extract the Member FYLD. Rudra, you mention

    "Dim params As IOSMemberSteelDgnParams"

    but that does not seem to be a valid type. Should I be using Variant?

  • Dim objOpenStaad As OpenSTAAD

    Huh? It should be "Dim objOpenStaad As Object". Params should also be dimensioned as an object. Until I made these changes your code snippet would not work.

    Also, what's the deal with the first argument in the GetMemberDesignParameters function? The manual says that's the design brief reference ID. What the . . .? I'm only familiar with the term "design brief" back when you had that silly GUI steel design do-dad. It's not even in the latest version of STAAD.Pro.

    And lastly, I'm glad to hear you are redesigning the manual. It is literally the worst I have ever seen.

  • Hi Joseph,

    The above declaration will work if you include "Staadpro.dll" as a Reference to your project.

    You can do this by launching the 'ScriptEditor' in administrator mode and select the above dll by browsing to the STAAD installation folder. Once added, the reference object will be available in the list if you launch the 'ScriptEditor' in normal mode. By including the DLL as reference, the intellisense of the object will be enabled. That means by putting a '.' after the object, you will get the list of its functions.

    If you are unable to add the reference, the way @Tank mentioned will work.

    Hope this helps.


    Rudra Lahiri

    Senior Principal Software Engineer, Structural


  • Hi Tank,

    Thanks for helping out Joseph.

    For your query, the first argument is the index of the PARAMETER/Design block count in the STD file. If there is only one PARAMETER block, then it will be '1' and subsequent blocks will be in serial increment like 2,3.. If you send '0' then it will iterate for the member number in all the blocks and return that of the first one.

    And yes, we are working on the format of the API manual.

    By the way, we have redesigned the Backup/Restore feature in latest Update 2 build. Have you tried it? Will be happy to hear your feedback. Will be adding a comparison tool in the next update.


    Rudra Lahiri

    Senior Principal Software Engineer, Structural