Send Hotkey Issue with Excel

Can someone please help me with an issue? I am running a sequence of “Send Hotkey” actions in order to rename an Excel worksheet and then save it. The sequence of commands works just fine when I test running it from the start of that specific activity. However, when I run it along with all of the other activities within my Excel Application Scope it doesn’t work. It’s not throwing an error it just isn’t renaming and saving the file. Does anyone know why this might be?


1 Like

Did u try doing it programmatically?

Hello @dumwalke!

UiPath does not have a way to rename sheets. What you can do is:

  1. Use a “Read Range” activity, without any field set, and the old SheetName: It will read all the desired actual sheet and store it in a DataTable.
  2. Use a “Write Range” activity, with field set in A1, and a brand new SheetName: It will paste all the values in a new sheet with the name you want.

Does this meet the requirement? Some times, when native activities aren’t developed, we have to think some OOTB solutions haha.

Best regards!

As I mentioned, I’m able to rename the sheet just fine using the Send Hotkey activities

  • Send Hotkey Alt + h
  • Send Hotkey Alt + o
  • Send Hotkey Alt + r
  • Type Into “new sheet name”
  • Send Hotkey enter
  • Send Hotkey Ctrl + s

These all work just fine by themselves. The issue is when I run my program as a complete package with many additional steps and activities before these it doesn’t seem to work. It just doesn’t look like it performs the steps at all and it completes with no errors?

May i know the issue or error you were getting
Cheers @dumwalke

You can use simple Macro for this
Sub Macro1()

    Sheets("Sheet1").Name = "Pratham"
End Sub

Use this macro by using invoke vba

1 Like

Hi @dumwalke,

I think you are trying to rename sheet. you can use this activity to rename the Excel sheet.


1 Like

For rename the sheets please go with workflow
Rename an Existing Worksheet In Excel.xaml (16.4 KB)

Hope it will work for you!!

Cheers @dumwalke

1 Like

Thanks @abhay! I used your macro suggestion and that proved to be the simplest solution. Thank you all for your help and recommendations.

Hi @dumwalke, It may be due to focus of excel file. It happened to me too. You can simply maximize the window and can send hot keys after that. It will work.

Thank you @ranjith_udayakumar for the suggestion! I’ll try that as well.

Hello, I think your solution is exactly what I’m looking for.
But some activity is missing.
Could you send me full package? Thank youuu

1 Like

Hi @irene1018b,

Here is the package.

Thank you