Click here to Skip to main content
15,918,268 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,

I am automating the webpage. While updating the textbox some key shold be pressed in that textbox. But I am coping values directly tin that textbox through code in vba. So values are note getting updated.

I have tried sendkeys. But its not working. giving error. code is as folows

iItems.SendKeys "{L}"

Error : Object does not have this property or method.
Please suggest me some solution.

thank you
Posted

1 solution

Whatever that iItems object is it doesn't have a SendKeys method so you're getting that error.

SendKeys is a stand-alone function. You just remove the iItems. part and you won't get that error any more.

But, SendKeys is notoriously unreliable. You have no direct control over which control gets those keys. Even the user clicking on something else (the most common problem!) while your code is running will screw up and send your keys to whatever they clicked on. You cannot control this.
 
Share this answer
 
Comments
Member 12119299 6-Nov-15 8:41am    
I want to press enter key in a textbox through code. How can be on that?
Sergey Alexandrovich Kryukov 6-Nov-15 8:43am    
It you think that you want it, it does not mean that you really want it. Just insert new line in text.
—SA
Dave Kreskowiak 6-Nov-15 10:04am    
Why?
Sergey Alexandrovich Kryukov 6-Nov-15 8:42am    
5ed. You are right. It's hard to imagine any use of SendKeys, only abuse. Some use it to mimic input just because they don't know who to change some UI state programmatically; and for anything serious (such as keyboard macro) this thing is totally unsuitable.
—SA
Maciej Los 6-Nov-15 14:19pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900