Ok...Made the correction....
DoCmd.OutputTo acOutputQuery, qryname, acFormatXLS, theFilepath, True
Compiles now. Thanks
So, I still can't get arnelgp code to work. I have created the function and when I'm getting an error: sub or function not defined
Pointing to Call fnkCreateFolder...