The error appears on the following code:

.WriteText Join(Application.Index(RC, R), ","), 1