Paste Value Excel - COM Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Paste Value Excel - COM

07 Sep 2019, 09:19

Good morning friends...
They have helped me before here to paste the value of a variable into a cell in Excel.
In this case I determine which cell to paste the value into.

Code: Select all

xlApp := ComObjCreate("Excel.Application")
xlAppDown := -4121
xlApp.Visible := true
xlApp.DisplayAlerts := False
oxWorkbook := xlApp.Workbooks.Open("C:\Temp\Some_Plan.xlsm")
xlApp.Range("A2").Value := VarToPaste
But what would I do if I had to paste the value into any cell? Because sometimes I look for a blank cell and I have to paste the value.
I try something like this...but doesnt work

Code: Select all

xlApp := ComObjCreate("Excel.Application")
xlAppDown := -4121
xlApp.Visible := true
xlApp.DisplayAlerts := False
oxWorkbook := xlApp.Workbooks.Open("C:\Temp\Some_Plan.xlsm")
xlApp.ActiveSheet.Value := VarToPaste
User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Paste Value Excel - COM  Topic is solved

07 Sep 2019, 11:50

Do you mean whichever cell is currently selected? Try the following:
xlApp.ActiveCell.Value := VarToPaste
snowmind
Posts: 124
Joined: 12 Nov 2015, 15:18

Re: Paste Value Excel - COM

08 Sep 2019, 15:35

boiler wrote:
07 Sep 2019, 11:50
Do you mean whichever cell is currently selected? Try the following:
xlApp.ActiveCell.Value := VarToPaste
Yes!!!! Its perfect now
Thanks a lot :bravo:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 337 guests