The ActiveWorkbook.name = *.xls (I believe this would supercede theconflicting request to save as *.txt)You want nombre to equal everything to the left of the '.xls'So, nombre = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)