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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendKeys Expression

Status
Not open for further replies.

bzsurf03

MIS
Dec 13, 2002
75
0
0
US
I am using the Shell method to open a particular PDF file during an Excel macro prior to the code below. I am trying to pass Control + A (Select All) and Control + C to the PDF file. Something is not working correctly. Anyone have any suggestions.

AppActivate "Adobe Reader"
SendKeys "^(A)", True
SendKeys "^(C)", True

Thanks in advance.

 
Hi
This seems to work. You may be able to use bits of it. :)
Code:
RetVal = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.EXE", 1)
AppActivate RetVal
'Open file
SendKeys "%(FO)C:\Datasheet.pdf", True
SendKeys "{ENTER}"
'Select
SendKeys "%(EL)", True
'Copy
SendKeys "%(EC)", True
 
Thanks for the help but for some reason the code below is opening the print dialogue.

SendKeys "%(FO)C:\Datasheet.pdf", True

It looks like it should work. I don't know what to say.
 
Check this out. This code does work as does my code. For some reason this does not work while debugging. You have to let the code finish on its own before breaking. This kind of makes sense in that the focus needs to stay on the app during processing. Focus is assume is taken away when processing code one line at a time.

Thanks.
 
Odd, as they say, it worked when I tried it. :)
How about using:
[tt]RetVal = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.EXE C:\Datasheet.pdf", 1)[/tt]
To open the file and leaving out the other file open lines? <guesses frantically>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top