3 Replies Latest reply on Apr 14, 2016 7:35 AM by Deepak Gupta

    pack and go macro adaption

    A. D.

      Dear all,

       

      I'm quite new into VBA, and am looking for a solution to run a pack and go from a macro.

       

      Pack and go macro -->without old number

      I found this macro, which works quite well, but i would like to adapt it a bit.

       

      Is it possible to pack and go to the current save folder? (Eventually add a new folder to this folder, in which the pack and go'd files will be saved)

       

      Is it possible to give each file their original name, with a pre- or suffix, taken out of the top level assembly properties? (For example customer/project name)

       

      And, is it possible to give a specific sub-folder structure? I'm used to make a folder hierarchy like shown in the picture below.

      Example.JPG

      So, a projectfolder, which contains separate folders for each 'type of file', and the top-level assemby directly in it.

       

      I'm willing to learn some vba/api offcourse, and am looking forward to your help.

       

      Best regards,

      Arno

        • Re: pack and go macro adaption
          Deepak Gupta

          Is it possible to pack and go to the current save folder? (Eventually add a new folder to this folder, in which the pack and go'd files will be saved)

          Get the current folder and set that as sOutputPath. And then

              If Dir(strOutputPath & "\" & "Folder Name Here", vbDirectory) = "" Then

                  MkDir strOutputPath & "\" & "Folder Name Here"

              End If

              sOutputPath = strOutputPath & "\" & "Folder Name Here"

           

          Is it possible to give each file their original name, with a pre- or suffix, taken out of the top level assembly properties? (For example customer/project name)

          Check this post: Macro Help: Pack and go With drawings and change name to property

          And, is it possible to give a specific sub-folder structure? I'm used to make a folder hierarchy like shown in the picture below.

          I think yes this can be done. You can set the output path accordingly based on file extension OR if you've the current files in same structure then using

          swPackAndGo.FlattenToSingleFolder = False

           

          Also check this example for related answers  Pack and Go an Assembly (VBA)