I originally wrote a function to perform on a project, but now the user wants to have the option to perform this function on either a project or a folder. I have about 200 lines of code that I want to perform in a loop on either the entire parent project or the individual parent folder. Is there an easy way to create a for loop that can use either type? I've tried to set a folder variable to the current Project, thinking that a project is simply a special type of folder. However, I get an error if I try to do this (incorrect arguments for (=) ). Do I need to put the 200 lines of code into a separate function just so I don't have to repeat the same code for current Project and current folder?