I think you should not dim $ClientColor as it is in the arguments of your Function