andy7172289
Technical User
Hi all,
Below the line is some code I've written with the purpose to go between excel and an old program called TRUST. It works up till the point which I've highlighted in yellow. The idea is to basically eradicate the manual process of doing this through a macro which can just input the letters and paste the next new number in one by one.
Anyway - any ideas for a better way to do it would also be appreciated (I've explored sendmessage using API and Spy+++ but I can't get Visual Studio on my pc).
Thanks in Advance for any help with this.
Andy
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub switchbetweentrustandexcel()
' This is a test macro to switch between TRUST and excel
Dim IDTRUST As Variant
Dim Path As String
Dim IDEXCEL As Worksheet
'........................................................................................................................
' Set the Path variable equal to the path of your program's installation
Path = "C:\Program Files (x86)\WinVVTN\WinVVTN\WinVVTN.exe"
IDTRUST = Shell("C:\Program Files (x86)\WinVVTN\WinVVTN.exe", vbNormalFocus)
MsgBox "Please log in to WinVV and leave it on the blank input screen. This is to enable a TRJG search."
Dim IDnotepad As Double ' to identify application with AppActivate
Workbooks("Automated Incident Number Correction in TRUST Macro.xlsm").Sheets("1").Activate
Range("B2").Select
ActiveCell.Copy
AppActivate ("SCR1 - WinVV Session 1")
'''''''''' Text from excel to paste in after some letters
[highlight #FCE94F]SendKeys "T"
[/highlight] Application.Wait Now + TimeValue("0:00:02")
SendKeys "R"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "J"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "G"
Application.Wait Now + TimeValue("0:00:02")
SendKeys " "
Wait Now + TimeValue("0:00:02")
SendKeys "^(V)"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "{enter}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "A"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{Enter}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{F4}
Below the line is some code I've written with the purpose to go between excel and an old program called TRUST. It works up till the point which I've highlighted in yellow. The idea is to basically eradicate the manual process of doing this through a macro which can just input the letters and paste the next new number in one by one.
Anyway - any ideas for a better way to do it would also be appreciated (I've explored sendmessage using API and Spy+++ but I can't get Visual Studio on my pc).
Thanks in Advance for any help with this.
Andy
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub switchbetweentrustandexcel()
' This is a test macro to switch between TRUST and excel
Dim IDTRUST As Variant
Dim Path As String
Dim IDEXCEL As Worksheet
'........................................................................................................................
' Set the Path variable equal to the path of your program's installation
Path = "C:\Program Files (x86)\WinVVTN\WinVVTN\WinVVTN.exe"
IDTRUST = Shell("C:\Program Files (x86)\WinVVTN\WinVVTN.exe", vbNormalFocus)
MsgBox "Please log in to WinVV and leave it on the blank input screen. This is to enable a TRJG search."
Dim IDnotepad As Double ' to identify application with AppActivate
Workbooks("Automated Incident Number Correction in TRUST Macro.xlsm").Sheets("1").Activate
Range("B2").Select
ActiveCell.Copy
AppActivate ("SCR1 - WinVV Session 1")
'''''''''' Text from excel to paste in after some letters
[highlight #FCE94F]SendKeys "T"
[/highlight] Application.Wait Now + TimeValue("0:00:02")
SendKeys "R"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "J"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "G"
Application.Wait Now + TimeValue("0:00:02")
SendKeys " "
Wait Now + TimeValue("0:00:02")
SendKeys "^(V)"
Application.Wait Now + TimeValue("0:00:02")
SendKeys "{enter}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{TAB}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "A"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{Enter}"
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "{F4}