I'm trying to send information to another application using the SendKeys function but it isn't working. The primary code that I'm using is:
ActiveWorkbook.FollowHyperlink Address:="http://www.aasb.com.au/public_docs/aasb_standards_2005/compilations/AASB101_07-04_COMP_11-05.pdf", _
NewWindow:=True
AppActivate "Microsoft Internet Explorer"
Application.SendKeys "^F34.~", True.
Sometimes I get an error on the AppActivate statement and sometimes the SendKeys function works but not all the time. Does anyone have any suggestions about what I'm doing wrong for it to not work all the time

SendKeys from Excel
Xiao Feng
Derek's answer was right on. I wrestled with a similar problem last week, trying to use VBA code to automagically copy certain text fields from a PDF document. What I found was that, to put it simply, Acrobat (I'm assuming that's the application you're using to view the PDF file) has some odd quirks which make it "different" to interact with from other processes. I suspect the ActiveX control is no different. Anyway, that's an issue for another board
Billr17
Derek,
Thanks very much for that. I've tried adding the wait and it seems to have done the trick. I'll replicate it over the 200 or so and see what the go is. I tried sending just blank data through a couple of of additonal SendKeys statements but that didn't make any difference.
I thought about the AppActivate not hitting the write Explorer session, but because the link opens a new session each time, it seems to be taking the latest session that has been opened.
Anyways thanks a heap for your help.
Madhu Reddy
Hi lofe,
Try adding a pause between the activating the application and sending the keys.
AppActivate "Microsoft Internet Explorer"
Application.Wait(Now + TimeValue("0:00:02")) 'wait two seconds
Application.SendKeys "^F34.~", True
This might or might not solve the problem but I'd do it anyway.
Edit: also the approach your using may not work if the user has a number of internet explorer windows open. The AppActivate method may activate the wrong window if there are a number of IE windows open.