Loop through listbox to get count of specific file extension

As your second argument to the keyConvert script you are passing a Boolean, i.e. the result of a string comparison that inevitably is false. You need to construct your output file path differently. As Scott Griffitts wrote, you are using the wrong operator, however I don’t think right(5) gives you the correct answer either. Perhaps:

Listbox1.Cell(i,0).Left(Listbox1.Cell(i,0).Len-4) //if input has "key" extension.  Use -8 for "keynote"

I highly recommend breaking up the statement so you can examine the different string pieces in the debugger.