Discussion Locked

Closing MS Project 2000 MSGBOX from VB6

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to close a message box within MS PROJECT 2000 from VB6 using sendkeys. Automation fails when the sendkeys does not close a msgbox in the opened File:
objRS.MoveFirst
Do Until objRS.EOF
strProjectName = strProjectDSN & Trim(objRS("PROJ_NAME"))
DoEvents
objProject.DisplayAlerts = False
objProject.FileOpen (strProjectName)
SendKeys "{ENTER}"
If objProject.Projects.Item(1).ReadOnly Then
objProject.FileClose
GoTo EndofLoop
End If
I know that I am missing something

1 reply

by tony hopkinson

Sendkeys are going to your application window not the dialog box for ms project would be my instant guess. When you want to send key strokes to another window, you need to get it's handle and then send the key stroke messages to it.
Look the up FindWindow, SendMessage and PostMessage APIs. I suspect you'll want the latter as it only returns to your code when the messages has been accepted whareas sendmessage is asynchronous.

This discussion is closed to new replies.