Apparently the code posted has nothing to do with the issue at hand.

If you are looking to read data from a file and replace the selected text with the data from the file then you will need to open the file, read the data into a variable, insert it into the RTB and then of course save the data in the RTB to file if you want to save it.

If you have written code for this then post that and let us know where you are having an issue. The code above just shows a dialog to save as but does not really do anything else.