Since we have no log with errors, warnings and notes and a piece of code we cannot use to test with, it will be difficult to find someone on the community that can help you. Did this code work in the past? Did you inherit the code or did you write it yourself? If yes, did you first write some code without using a macro that worked? Can you reproduce the error with a simple dataset like for instance sashelp.class using the base code from your program to send an email? Does that result in the same file-in-use error?
... View more