Welcome to the RAS Solution Forums HECRAS Controller Select the folder to open RAS project

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8174
    PaoloP
    Participant

    Sometimes could be useful to select from folder the RAS project to open instead of write its path in Excel or inside the code.
    The following are the commands to do this in VBA:

    ‘**********************************************
    ‘Choose files and folder
    Dim fd As FileDialog
    ‘Select one or more files
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    ‘Clear the filters and define as “*.prj”
    fd.Filters.Clear
    fd.Filters.Add “RAS project”, “*.prj”
    Dim varSelectedFile As Variant
    Dim strFilePrj As String
    ‘If more than one file has been selected only the last will be used
    With fd
    If .Show = -1 Then
    For Each varSelectedFile In .SelectedItems
    strFilePrj = CStr(varSelectedFile)
    Next varSelectedFile
    Else
    End If
    End With
    Set fd = Nothing
    ‘*****************************************************

    in the variable strFilePrj there is the path and name of the *.prj file you have selected.

    I hope this help

    Paolo Polo

    #13499
    Chris G.
    Keymaster

    Thanks Paolo!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.