Assign the result to a string var rather than showing in a message box.
Create and open a file object.
Write the contents of the string var to the file.
Close the file object.