CutCopyMode not working
CutCopyMode not working
When I paste data into Excel cells with AHK, those cells are selected. I need to unselect them. I tried xlApp.Application.CutCopyMode := False, but it doesn't work. Any ideas?
Re: CutCopyMode not working
Why do they need to be unselected? But if you insist, select another cell. At least one cell will always be selected.
.CutCopyMode := False doesn't uneselect cells. It takes them out of cut/copy mode, and pasted cells aren't in that state in the first place.
.CutCopyMode := False doesn't uneselect cells. It takes them out of cut/copy mode, and pasted cells aren't in that state in the first place.
Re: CutCopyMode not working
Need to unselect because when I run the script a second time with new data, I get an error because the previous cells are selected.
Yes, that's my workaround for now, to select something else. XL_Select_Range(xlApp,"A1:A1") (using Joe Glines XL.ahk)
Yes, that's my workaround for now, to select something else. XL_Select_Range(xlApp,"A1:A1") (using Joe Glines XL.ahk)
- flyingDman
- Posts: 2817
- Joined: 29 Sep 2013, 19:01
Re: CutCopyMode not working
You're not telling us how you copy and paste. Are you using:
or
or
As far as I know only the last method leaves the target range selected.
And, BTW, you do not need a "wrapper" function to select a range: See here https://docs.microsoft.com/en-us/office/vba/api/excel.range.select
Code: Select all
xl.range("G6:G8").copy(xl.range("M6:M8"))
Code: Select all
xl.range("G6:G8").copy
xl.activesheet.paste(xl.range("M6"))
Code: Select all
xl.range("G6:G8").copy
xl.activesheet.Range("M6").PasteSpecial(-4104)
And, BTW, you do not need a "wrapper" function to select a range:
Code: Select all
xl.range("a1").select
14.3 & 1.3.7
Re: CutCopyMode not working
I copy the Clipboard data outside Excel and paste it into my script after running code on it.
Correct about the wrapper, I guess I can use xlApp.Sheets("MAIN-WORDS").Range("A1").Select. I'm just familiar with the XL libraries.
Correct about the wrapper, I guess I can use xlApp.Sheets("MAIN-WORDS").Range("A1").Select. I'm just familiar with the XL libraries.
- flyingDman
- Posts: 2817
- Joined: 29 Sep 2013, 19:01
Re: CutCopyMode not working
That's the issue with these wrappers. You forget the original functionality...
14.3 & 1.3.7
Re: CutCopyMode not working
And to me, this wrapper doesn't really simplify anything. It just seems like needing to memorize different syntax that is at least as complex as the native syntax that is being wrapped.
Re: CutCopyMode not working
You're probably right, but since I have the XL.ahk loaded, I just type "XL_" and I get a popup showing me all the available functions.