Solved

sendkeys

Posted on 2001-06-22
8
334 Views
Last Modified: 2010-08-05
What do I need to add to this --

I'm trying to run setup.exe and have(enter) pressed when the dialog pops up???




Private Sub form_load()



Shell ("command.com /c c:\windows\desktop\setup.exe"), vbHide
SendKeys (enter)
End Sub
0
Comment
Question by:patrickm3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220522
AppActivate "Caption Of Setup.exe"
SendKeys "{ENTER}", True
0
 

Expert Comment

by:RichardVBman
ID: 6220540
I agree with JonFish85; you might also need to create a time delay between the activation of the form and the sendkeys statement (you'll need to adjust the forms timer interval to suit your own needs):

AppActivate"Caption Of Setup.exe"
Call Delay(10)
SendKeys "{ENTER}",True

'Paste this Function in the declarations section

Function Delay(lngDelay as long)

dim StartTime as long

StartTime = Timer
While Timer <> StartTime + lngDelay
   Doevents
Wend

End sub
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220577
Hello RichardVBMan! I notice that you are fairly new to EE. Here at EE, experts usually choose to post always with comments, as a proposed answer locks the question and moves it to the "Answered Questions" section. Also, your "answer" is basically the same as mine, just with revisions. Please just keep in mind that it is generally better to just use comments, since the questionerre can accept a comment as an answer. Just thought I'd let you know!
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:patrickm3
ID: 6223168
I've never used vb--could you tell me where to paste this stuff in?
0
 

Author Comment

by:patrickm3
ID: 6223189
I've never used vb--could you tell me where to paste this stuff in?
0
 
LVL 6

Accepted Solution

by:
JonFish85 earned 200 total points
ID: 6223514
try something like this:

Private Sub Form_Load()
  Shell "C:\Path\To\Setup\Setup.exe", vbNormalFocus
  DoEvents
  DoEvents
  'Replace "caption" with the caption of
  'the main setup.exe
  AppActivate "Caption", True
  DoEvents
  SendKeys "{ENTER}", True
End Sub
0
 
LVL 1

Expert Comment

by:Form_Glow
ID: 6224809
Why use SENDKEYS?
Just Loop until you get the handle of the "OK" button or whatever..

Do:Doevents
x = get the handle of button to click
loop until x

Call SendMessage(x, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessage(x, WM_LBUTTONUP, 0&, 0&)
 
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6494593
thanks for the points, but why the B grade?
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question