2 Replies Latest reply on Apr 19, 2016 6:36 PM by K. McCrorie

    Help, why does this macro crash?

    K. McCrorie

      Hi all.

      Firstly apologies I'm not very knowledgeable when it comes to macro's etc...


      Anyway, I've used the attached macro loads of time in SW2010 to batch add/edit custom properties.

      Recently I've upgraded to SW2016 and now it crashes my session when i attempt to run it.

      Stepping through shows me that it crashes at this point:


      Can anyone explain why and how to fix it?

      Much appreciated



        • Re: Help, why does this macro crash?
          Simon Turner

          You need to update the declaration for SHBrowseForFolderA to be 64 bit compatible:


          Private Type BROWSEINFO

                   hOwner As LongPtr

                   pidlRoot As LongPtr

                   pszDisplayName As String

                   lpszTitle As String

                   ulFlags As Long

                   lpfn As LongPtr

                   lParam As LongPtr

                   iImage As Long

               End Type


               Private Declare PtrSafe Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" _

                   (lpBrowseInfo As BROWSEINFO) As LongPtr