Asuming your on vb here is some code i dug up, youll want to substitute ypur own data in though obviously, have a mess with it see if you can get it working, thats how i learnt c++ and java.
Code:
' API declares
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Integer) As Integer
' send keys to selected app
'reusable sendkeys sub
Sub SendKeysToApplication(ByVal appTitle As String, ByVal keys As String)
' Find the other application.
Dim hWnd As Integer = FindWindow(Nothing, appTitle)
' Exit if not found.
If hWnd <= 0 Then
MessageBox.Show("Application not found", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
' Make it the active application.
SetForegroundWindow(hWnd)
' Send the keys and wait.
SendKeys.SendWait(keys)
End Sub
SendKeysToApplication("Word" , "{alt} {f4}")