Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendinding CTRL+A to IE

Status
Not open for further replies.

dg043

Programmer
Apr 22, 2002
52
GB
I am trying to send the keystrokes CTRL and A to Internet Explorer, to select all data on the page. I use the code

SendKeys "^A", True

in my application, but it doesn't do anything. However if I type something in Notepad and use the sam piece of VB, it does work. Has anybody else come across this in IE and do you know how to get around it?
 
Send Keys is messy - you might check out the Web Browser control - it is perhaps what you need to do

But this works for me

AppActivate ("Internet Explorer")
SendKeys ("%EA")

Instead of trying to send CTRL+A, I am sending ALT+E (Edit Menu) and then A

Hope this helps
Mark
 
Thanks Custom24. That does work. However the next stage of what I am trying to do is to embed the web browser itself into the VB application (as a WebBrowser control). The above no longer works because the browser does not have a menu bar. Any ideas now?
 
OK - I need to know exactly what it is you are trying to acheive - I've never done anything meaningful with the WebBrowser control, so I'm not an expert, but I'm willing to help.

Anyway, if you drop a WebBrowser and a Command Button onto a form, here is some code to put into the Command Buttons click event which navigates to Google.com and gets the text from the Web Page. Maybe this is what you need?

Private Sub Command1_Click()
Me.WebBrowser1.Navigate "'wait until it is downloaded
Do Until Me.WebBrowser1.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
'tell us that it is complete
MsgBox "Completed"
'get the contents into a string to show in a message box

Dim strText As String
strText = Me.WebBrowser1.Document.body.innerText
MsgBox strText
End Sub

Also, though this is quite techhie, here is a link which tells you about the web browser control

Let me know...

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top