web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send Keys not working ...
Power Automate
Unanswered

Send Keys not working in PAD after PAD update - any alternatives?

(1) ShareShare
ReportReport
Posted on by 8

In a PAD Workflow I am using the Send Keys function to do a copy and paste of a formula from 1 cell to another (control + C and then control + V), in an Excel file. 

The copy and paste occurs inside of a data table due to the "automatically" generated formula in the data table not being correct. 

 

The Send Keys function has previously been working without any issue, however after I updated my PAD application to the newest version, the control + c and the control + v does not do anything within the workflow. 

The function does not throw an error message, it just does not do the function that it is supposed to.

 

I have tried to resolve the issue by restarting my computer, as I have previously experienced that this would resolve the issue after the PAD application update. 

 

Anybody has any idea on why the Send Keys function is not working?

See the settings on the function below - please note that I have tried to adjust the Delay between keystrokes from the default value to 60, just to see if that would make a difference (no difference).

 

I have also tried to insert the Press/Hold function before the copy, without any luck.  

Identity47_0-1692450289453.png

 

I have read in other PAD posts on the Send Keys function that the Send Keys is prone to error and some users recommend not to use it due to this. 

However if I were not to use the Send Keys function, how would you suggest to copy and paste a formula from 1 cell to another?

 

Using a the screen recorder to record the copy and paste actions in Excel?

I have previously used the screen recorder for another part of my workflow, however I find it a bit unstable/unpredictable in terms of doing what I actually wanted it to do.

 

Thanks in advance. 

I have the same question (0)
  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Hi @Identity47 ,

     

    Here's what has worked for me in the past.  Confirm you can send any keys during this step; it is most likely not a send keys issue.  Look at the preceding step and confirm those are actually successful.

     

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Identity47 

     

    Instead of using send keys for copy paste operations, use below vbscript to copy the formula from one cell to another 

     

     

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    
    Set objWorkbook = objExcel.Workbooks.Open("D:\Temp\data.xlsx")
    Set objWorksheet = objWorkbook.Worksheets("Sheet1") ' Change to your sheet name
    
    ' Copy the formula from source cell
    sourceCellFormula = objWorksheet.Range("D2").Formula
    
    ' Paste the formula to destination cell
    objWorksheet.Range("D3").Formula = sourceCellFormula
    
    ' Save and close the workbook
    objWorkbook.Save
    objWorkbook.Close
    
    ' Quit Excel
    objExcel.Quit
    
    ' Release objects
    Set objWorksheet = Nothing
    Set objWorkbook = Nothing
    Set objExcel = Nothing
    

     

    Use Run VBScript action for this to run the vbscript like below:

    Nived_Nambiar_0-1692460346894.png

     

     

    Or if you are trying to do an autofilling approach use below vbscript :

     

     

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    
    Set objWorkbook = objExcel.Workbooks.Open("C:\Path\To\Your\Workbook.xlsx")
    Set objWorksheet = objWorkbook.Worksheets("Sheet1") ' Change to your sheet name
    
    ' Source cell address
    sourceCellAddress = "D2"
    
    ' Destination range for autofill
    destinationRange = objWorksheet.Range("D3:D10") ' Adjust this range as needed
    
    ' Get the source formula
    sourceCellFormula = objWorksheet.Range(sourceCellAddress).Formula
    
    ' Set the formula in the source cell
    objWorksheet.Range(sourceCellAddress).Formula = sourceCellFormula
    
    ' Autofill the formula to the destination range
    objWorksheet.Range(sourceCellAddress).AutoFill Destination:=destinationRange, Type:=xlFillDefault
    
    ' Save and close the workbook
    objWorkbook.Save
    objWorkbook.Close
    
    ' Quit Excel
    objExcel.Quit
    
    ' Release objects
    Set objWorksheet = Nothing
    Set objWorkbook = Nothing
    Set objExcel = Nothing
    

     

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Hi @Nived_Nambiar ,

     

    Nice!  You just picked up another subscriber at YouTube!  Thanks for sharing this, I will definitely implement. 

     

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @trice602 

     

    Thank you 🙂

     

     

  • Identity47 Profile Picture
    8 on at

    Hi @trice602,

     

    I am not quite sure what your suggestion for a solution is.

    Do you think that something in a previous workflow step is preventing the Send Keys function to work properly?

    I have had the Send Keys function to work properly before and even if after the PAD update, if I run the workflow separately the Send Keys functions working (I have combined multiple separate workflows into a combined workflow and included each of them as a subflow - if I run the workflows separately, the Send Keys function works)

     

    I tried to adjust the parameters in the Send Keys function a bit, and I adjusted the Send Keys destination from "Foreground window" to "Window instance/handle" and inserted the Excel instance that the copy and paste is to be done in.

    After this the Send Keys function with the copy and paste is working in the workflow.

    Identity47_0-1692820358955.png

     

     

    Oddly enough the Send Keys function is also working in other subflows, where I did not adjust the Send Keys destination (and the Send Keys function is in other sheets of the Excel file). 

  • Identity47 Profile Picture
    8 on at

    Hi @Nived_Nambiar 

     

    Thanks for the suggestion. 

     

    I tried to implement the VBScript, however I cannot quite get it to work (please note that I am not experienced in VB or VBA). 

     

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    
    Set objWorkbook = objExcel.Workbooks.Activate("Filename")
    ' Obviously I am using the actual file path in the VBScript that I have tried to run
    Set objWorksheet = objWorkbook.Worksheets("Data for waterfall") 
    ' Change to your sheet name
    
    ' Copy the formula from source cell
    sourceCellFormula = objWorksheet.Range("M51").Formula
    
    ' Paste the formula to destination cell
    SourceCellFormula = objWorksheet.Range("M53").Formula

    I change the objWorkbook to an Activate function instead of Open function, as the Excel file is already open in the workflow. 

    When I run it I can see that it activates Excel, but it does not do the copy and paste in the Excel file. 

    Am I doing something wrong here in getting the VBScript to utilize the already open workbook?

    Also, is it possible to reference to a workflow variable in the VBScript rather than having to insert the file path in the VBScript (such as the Excel instance, which is already a variable in the workflow)?

     

    Finally, for the paste destination, I need this to be the second last row in a data table. Is there a way of making the VBScript do this as well, so that the destination cell becomes dynamic?

    When I used the Send Keys function, I used the FirstFreeRows function to be able to get PAD to navigate to this. There will be added a new row each month when data is added to the Excel file and the workflow is run. 

     

    Thanks in advance. 

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Identity47 

     

     

    I think FileName is a variable from power automate desktop here if i am right , if yes change the script like below

     

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    
    Set objWorkbook = objExcel.Workbooks.Activate(%Filename%)
    ' Obviously I am using the actual file path in the VBScript that I have tried to run
    Set objWorksheet = objWorkbook.Worksheets("Data for waterfall") 
    ' Change to your sheet name
    
    ' Copy the formula from source cell
    sourceCellFormula = objWorksheet.Range("M51").Formula
    
    ' Paste the formula to destination cell
    SourceCellFormula = objWorksheet.Range("M53").Formula

     

     

    Try this and let me know 🙂

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you want to attach to a running Excel, you should not be creating the Excel object and instead you should "get" it. CreateObject is only used for when you want to launch a new instance of Excel.

     

    Also, the Workbooks.Activate method is used differently - you should pass the file name like this - Workbooks("{FileName}").Activate.

     

    Try this script (assuming that %FileName% contains an actual file name):

    'Attach to a running instance of Excel
    Set objExcel = GetObject(, "Excel.Application")
    
    'Activate the workbook
    Set objWorkbook = objExcel.Workbooks("%FileName%").Activate
    
    'Activate the worksheet
    Set objWorksheet = objWorkbook.Worksheets("Data for waterfall") 
    
    ' Copy the formula from source cell
    sourceCellFormula = objWorksheet.Range("M51").Formula
    
    ' Paste the formula to destination cell
    SourceCellFormula = objWorksheet.Range("M53").Formula

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard