2 Replies Latest reply on Jul 3, 2014 6:07 AM by Andreas Killer

    BUG in SldWorks.GetOpenFileName: How to choose first filter by default?

    Andreas Killer

      I have SW2014, I don't know if the issue described below is related also to other versions of SW (which I guess).


      The simple macro below opens the file dialog, I want to use 3 filters:

        - bitmap files

        - jpeg files

        - gif files


      When the dialog is opened, always the second filter (jpeg files) is choosed, but I want the first filter.


      When I open the filter combobox of the dialog, it shows correctly my items in the order I like.



        To change the order of the filters in not an option! The code below is just an example of a complexer macro.

        I can add "||" at the beginning of the file filter string as temporary workaround, means I have 4 filters and the first one is blank.

        I don't like to use a lot of API and use the windows common file dialog instead (I know how to use it).


      Is there any undocumented trick to get the first filter by default when the dialog is opened?




      Sub Main()
        Dim swApp As SldWorks.SldWorks
        Dim Path As String
        Dim fileOptions As Long
        Dim fileConfigName As String
        Dim fileDisplayName As String


        Set swApp = Application.SldWorks
        Path = swApp.GetOpenFileName("Select Bitmap", "", _
          "Bitmap Files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|Gif Files (*.gif)|*.gif|", _
          fileOptions, fileConfigName, fileDisplayName)
      End Sub