How to Open a Process and Send Keys to that Process ( e.g. MS Word )
03-Aug-1111 Leave a comment
Following works fine opens document, ctrl + g = go to in word, book mark “StockControl”
Dim process1 As New Process
process1.StartInfo.FileName = String.Concat(My.Settings.DocumentationDirectory, My.Settings.HelpWordFile)
process1.Start()
process1.WaitForInputIdle()
'Dim hwnd = process.MainWindowHandle
Threading.Thread.Sleep(1000)
SendKeys.Send("^g")
SendKeys.Send("+{TAB}")
SendKeys.Send("b")
SendKeys.Send("{TAB}")
SendKeys.Send("StockControl")
SendKeys.Send("{ENTER}")
SendKeys.Send("{ESC}")