Thank you so much for your reply,
Its seams its ,not possible to execut VBA code including "step-per-step" the only way is to run it complet code, so am I correct, is there any way to recover this limitation?
Thank you sir,
amrane
Sub SendKeysExample()
Dim AppID As Variant
AppID = Shell("C:\Windows\notepad.exe", 1)
AppActivate AppID
SendKeys "Hello", True
SendKeys "~", True
SendKeys "world", True
End Sub
I am sorry I missed to writ code including "Sendkey statement as per the below code:
Sub SendKeysExample()
Dim AppID As Variant
AppID = Shell("C:\Windows\notepad.exe", 1)
AppActivate AppID
SendKeys "Hello", True
SendKeys "~", True
SendKeys "world", True
End Sub
Amrane, what is your goal? Using SendKeys() to accomplish a goal is seldom a good idea. It should only be considered as a last resort. If your goal is to write to Notepad, there are several methods besides SendKeys() to do that.
As Mohanvijay said, IF you have Adobe Acrobat and not just the Reader, you can use the method that he posted to get text from a PDF file.
There are two basic issues with SendKeys: (1) focus, and (2) timing. While you can use a Wait method as you did to wait for focus to be set, there is no assurance that sufficient time was set. While I used your Wait method here, a better method is to Loop Until the active window is the window that is needed. A spy program can you show you Window caption title and class names.
e.g. In a Module:
[vba]Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function Putfocus Lib "user32" Alias "SetFocus" _
(ByVal hwnd As Long) As Long
Sub Shell_Copy_Paste()
Dim Pdf_file As Variant
Dim wkSheet As Worksheet
Dim xlmain As Long, xldesk As Long, excel As Long
i download the attached sheet when i click on the form button get an error "Active X component cannot create object " please help i really need of this file for my work better.
Thanks mohanvijay for your reply , i have only reader not complete version of acrobat . I will install full version of Adobe Acrobat professional version 7.0 and run ?