Batch File Macro

Problem:  Retrieving pictures from a folder to resize and crop

 

I take pictures and download to my laptop.  I then select 1 by one to resize and crop.  I recorded a macro to resize and crop but can only do 1 at a time.  I want to run a batch file that selects each picture and runs he resize and crop macro.  I won't know the file names in advance since they will always be changing but will always be in the same folder.

I need help in figuring out how to writhe batch file.

 

Thank you.

 

-Don-

Parents
  • The general way of processing all files of a certain type is a folder is ...

     Dim objFSO As Object
        Dim objFolder As Object
        Dim objFile As Object
        Dim i As Integer
        Set objFSO = CreateObject("Scripting.FileSystemObject")
       
        Set objFolder = objFSO.GetFolder(" ........ " )     ' -- put the folder name between the quotes (or get its value from a textbox)
       
        'Process all PNG files in that folder   (change png to jpg or tif if appropriate)
       
        For Each objFile In objFolder.Files
            If LCase(Right(objFile.Name, 4)) = ".png" Then

                do_some_code(objFile.Name)           ' calls your code and passes the filename

            End If

        Next objFile
    End Sub

    'Then you must isolate the important steps from your recorded macro and insert it in here ...

    sub do_some_code(fileName)

           '......... insert code to process your file -- you must delete the name of the file you recorded *and* its quotes, and replace it with the word fileName *without* adding the quotes back.

    end sub

    - - -

    If in doubt, post the code of the macro you recorded and we'll try to sort you out.

     

Reply Children
No Data