简体   繁体   中英

sendkeys does not seem to be working in vba

I am trying to use an excel add in in VBA. Unfortunately recording the macro doesn't seem to work and hence the reason I want to try use the keyboard shortcuts. The shortcut I am after is ALT X 2 V. I have tried using SendKeys.send ("%{x}{2}{v}")

but every time I try to use it, the code write the values "2v" to my vba screen. I am not sure I have fully understood how to use this method as I want the actions to be actioned in excel so that I can access this add in.

I have been through the forums but can't seem to get an answer, which includes putting a wait command between each keystroke. Could really do with some help.

Try SendKeys "%x2v" That said, using sendkeys is almost always a Bad Idea. I understand that you're trying to call some function from an addin, but if you're able to access that code at all, I would do so, and call whatever you're trying to run directly. At some point, SendKeys will mess something up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM