Solving your problem requires a communication mechanism between the EXE and VBA. Currently, the EXE is doing nothing with the result of the Extract method. In order to get the result back to VBA, place the result into StdOut.
Here's how to do this on the EXE side:
Option Explicit
Private Sub Main()
Dim e As String
e = Extract(Command)
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim stdOutput As TextStream
Set stdOutput = fso.GetStandardStream(StdOut)
stdOutput.WriteLine e
End Sub
Private Function Extract(ByVal StrKey As String) As String
Extract = Mid(StrKey, InStr(StrKey, "_") + 1, Len(StrKey))
End Function
On the VBA side, here's how you get the result from StdOut:
Option Explicit
Public Sub Test()
Dim ret As String
ret = ShellRun("c:\TEMP\Extract\Extract.exe" & " " & "ghhfghfgh_hgfhg")
MsgBox ret
End Sub
Public Function ShellRun(sCmd As String) As String
'run a shell command and return stdout as a string
Dim oShell As Object
Set oShell = CreateObject("WScript.Shell")
Dim oExec As Object
Set oExec = oShell.Exec(sCmd)
Dim s As String
s = oExec.StdOut.ReadAll
ShellRun = Left(s, Len(s) - 2)
End Function
The ShellRun
code came from this link.