Controlling/automating an Excel instance running as another user


I have a bot that needs to apply data to an Excel Workbook. For security/licensing reasons, the Excel instance must run as a specific user that is not the same user as the bot.

The bot starts Excel as another user by invoking .NET code that instantiates a Process pointing to Excel. This is done in an “Invoke Code” activity like this:

var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = false;
startInfo.WorkingDirectory = in_ExcelDirectory;
startInfo.FileName = Path.Combine(in_ExcelDirectory, “EXCEL.EXE”);
startInfo.Domain = “”;
startInfo.UserName = in_ErpUsername;
startInfo.PasswordInClearText = in_ErpPassword;
var proc = new Process();
proc.StartInfo = startInfo;

Is there another/better/built-in way to do this in UiPath?

After starting up Excel as another user, the bot is not able to connect to that running instance by making use of either an “Excel Application Scope” or “Excel Process Scope” (both holding an “Use Excel File” activity). Depending on how I set them up, they either starts up a new instance of Excel running as the bot user or throws an exception saying that they cannot find any running Excel instance (probably because it cannot see the excel process running under a different user).

Has anyone had/solved a similar challenge? If so any advice on how to automate/control Excel running under a different user would be highly appreciated.