If your objective is to reuse variables, here goes the way to go:
CString WriteString;
....
WriteString.Format("%s.%d d", CString(WriteString),NI);
Notice the CString() constructor call. You will have not problems because your format receives a copy of WriteString, instead of manipulating it directly.