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

Troubles with shell, appActivate and Sendkeys (error 5)

Status
Not open for further replies.

GeorgiK

Programmer
Mar 10, 1999
17
MK
Hi,

I've got problems with this simple piece of code.
I try to automate CD burning with executing Nero burning
software, than sending some kestrokes to it in order to
erase the CDRW, than burn the new backup files and finally
exit the application.
It opens the Nero application, but after that I get:

Run-time error '5':
Invalid procedure call or argument

The platform is Win2000 Professional (same happens on
Win2000 Server).
The form is also very simple - one textbox for entering the
description of the backup (label for CD) and one command
button (Command1) for which the code is shown below:

Private Sub Command1_Click()
Dim dRate As Double
Dim curPayment As Currency, curLoan As Currency
Dim iYears As Integer

Dim rtrn

Screen.MousePointer = vbHourglass

rtrn = Shell("C:\Program Files\ahead\Nero\nero.exe", 1) ' Run Nero.
AppActivate rtrn, True ' activate Nero.

SendKeys "{~}{~}{~}{~}", True ' type some keys in wizard
SendKeys "{%}rw{~}", True ' RW erase
SendKeys "{F2}" & Me.Glavnica & "{~}{^}{TAB}{^}a{^}c{^}{TAB}{^}v{%}fw{~}", True ' Burn the CD
SendKeys "{~}d{%}fxn", True ' end of Nero.

Screen.MousePointer = vbDefault

End Sub

Maybe there are other ways to automate the kestrokes in an
applications ...

Help!
George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top