Ok I have some code I have been using but depending on what I am working on I have to modify it. I am sure it would be easy for someone who knows javascript to do this. I do not use javascript. here is the code with my comments added when I was modifying it.
function AutomateExcel3()
{...