3 Replies Latest reply on Dec 7, 2018 8:35 AM by Danniel Sims

    printing from excel

    Mike Flanders

      I was wondering if anyone has a macro set up to have a list of items in an Excel spreadsheet and have it look for them in a drawings folder, open them and print them out?Fifi Riri

        • Re: printing from excel
          Mike Flanders

          I'm looking for a macro or independent program that will take and look for these numbers within the customer folders below and open that drawing up and run a macro that is already created, print it out. I can export these numbers into and excel spreadsheet. The item number here is our internal part number for our customer parts. I save our parts as the customer part number but apply our part number (52345678) to the model's description. I I know it is possible to search in windows under the description so I think it should be able to loop though all these folders and find these prints. I could always add in the customer folder name to the macro so it directs it to the correct folder and speeds up the search.

          JOB ORDER LIST.JPG

          CUSTOMER FOLDERS.JPG

            • Re: printing from excel
              Danniel Sims

              I have a "Part Finder" macro my company uses for locating prints.  Part of the code loops through several network locations to pull drawings,pdfs, BOMs, etc.  Below is a cutout of the basic looping principal.  I can put any number of folders into the Dest variable.  It will break them out and find any hits that fit the nindgt variable (a modified string from the Activecell in Excel).  You could even create a loop before this to traverse all the folders in your main folder and load up the Dest Variable to whatever folders are currently in it.  You do have to be careful about folder names with special characters, some get turned into wildcards and will make the search fail.

               

              Set msf = mfs.GetFolder(""Your top filepath")

              For Each mf In msf.SubFolders

                   Dest = Dest & mf & "|"

              Next

               

              Or manually load specific folders

               

              Dest = "G:\SolidWorks\Machining\|G:\SolidWorks\Turning\|G:\SolidWorks\Std Parts Library\"      ' All folder paths separated by |

               

              DestSplit = Split(Dest, "|")

              DestCnt = 0

               

              Do Until DestCnt = UBound(DestSplit) + 1

                   'Debug.Print DestSplit(DestCnt)

                   On Error Resume Next

                   strPath = DestSplit(DestCnt) & nindgt & "*" 'nindgt (We use 11 digit part numbers, to get all versions I wildcard the first and last digit)

                   strFile = Dir(strPath)

                

                   Do While strFile <> ""

                        ufBOMSeek.lbSeek.AddItem (DestSplit(DestCnt) & strFile) ' This loads to a userform where the user selects the file to open - replace           this with whatever open/printing/close code you plan to use.

                   strFile = Dir    ' Get next entry.

                   Loop

               

              DestCnt = DestCnt + 1

              Loop