How send to send hotkeys from vb.net in UiPath?

Hi,
I need to send hotkeys like (Cntrl+C/Cntrl+V) from vb.net in Excel sheet,
Can anyone please help me to know how I can do that?

I have tried with below code, but it doesn’t type anything

Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim rng As Microsoft.Office.Interop.Excel.Range
Try
wb = DirectCast(GetObject(Path),Microsoft.Office.Interop.Excel.Workbook)
Catch ex As Exception
excel = DirectCast(CreateObject(“Excel.Application”), Microsoft.Office.Interop.Excel.Application)
wb = excel.Workbooks.Open(Path)
excel.Visible=True
End Try
ws=CType(wb.Sheets(“Output”),Microsoft.Office.Interop.Excel.Worksheet)
ws.Activate
SKey.SendWait(“hello”) (Declared in the arguments)
wb.Save

Thanks

Hello @anjalimishra

Do you need currently to send hotkeys? Because you can use another way to do this.

For example:

  • Read Excel sheet with activitie “Read Range”
  • get your data you need
  • Fill the field with the data you want

This would replace the send hotkeys.

Or you can to do as below

To copy the data in the desired field

  • Select the the field in Excel sheet
    -With activitie “Send Hotkeys” send CRTL + A (you’ll select the data)
    -With activitie “Send Hotkeys” send CRTL + c (it will copy the data)
    -With activitie “Get from clipboard” Get the data to string

To Paste the data in the desired field

  • Use activitie “Set to clipboard” as input your string
    -Select the the field in Excel sheet
    -With activitie “Send Hotkeys” send CRTL + v (you’ll paste the data)

See image below:
image

2 Likes