May need a sample file. I have a similar macro in my macros collection, and I have not experienced the same problem. Relevant code
The only trouble I have ever had is in the case of brand new workbooks before they have been saved where the workbook doesn't have a path, yet.
I would probably put a "stop" statement after your "filename = ActiveWorkbook.Path & "\textfile-" & Format(Now, "ddmmyy-hhmmss") & ".txt"" statement (maybe earlier). Then, when VBA enters debug mode, I would check to see what is going on. What value has been stored in filename? What workbook is active?
Bookmarks