Humbled Guy
03-21-2017, 09:19 PM
Hello and thank you for taking interest in helping me with my problem. First and foremost I am billing coder with aspirations of becoming a programmer one day. This year was the year that I discovered macros, scripts, automation, etc. and I have completely falling in love with it. However I only know what I know (and that's not allot), the problem that I am having is creating a vba macro that is embedded in a program my job use which is called "Powerterm Pro". In the past I figured out how to copy screen data via the emulation screen (vt3020-7) and paste it to excel, and from there I created other macros to basically search for billing codes, copy the cell and return the matching data back to Powerterm. However now, I would like to ditch using excel and "recreate" the macro that I was using in excel, in Powerterm Pro (which features VBA, but with it's own methods, procedures, etc.). Here is the code that I created for excel:
Sub Test()
Dim RetValue As String
Dim Prompt As String
Dim Rng As Range
With Sheets("BDEscreen")
Do While True
RetValue = InputBox(Prompt:="Enter ABN Test", Title:="Optum360 TM", Xpos:=3090, YPos:=10500)
'If no test entered
If RetValue = "" Then
Call ReturnToBDE
Call SendKeyNumOff
DoEvents
Exit Do
End If
'If test is found
Set Rng = .Columns("B:B").Cells.Find(What:=RetValue, After:=.Range("B9"), LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
'If test is not found
If Rng Is Nothing Then
Prompt = "Test """ & RetValue & """ not found," & " press ESC to exit"
Range("b31").Value = RetValue
DoEvents
Else
Range("b31").Value = RetValue
Call ReturnToBDE
DoEvents
End If
Prompt = Prompt & vbLf
Loop
End With
Exit Sub
End Sub
So for the last 2 months I have been searching every website that I possibly could and unfortunately I cannot find anything to help me with recreating this within the Powerterm application. Below is the code that I tried to recreate using the powerterm methods, but I just can't do it. Please help...
Sub Testbeta()
Dim AbnTest As String
Dim Prompt As String
Dim Rng As Object
PtermPro.Application.Setup.EmulationType = ptVt320_7
Do While True
AbnTest = InputBox(Prompt:="Enter ABN Test", Title:="Optum360 TM", Xpos:=3090, YPos:=10500) 'this works fine
'If no test entered
If AbnTest = "" Then
Call ReturnToBDE
Exit Do
End If
'If test is found
Rng = PtermPro.Application.VBA.Trim(CStr(PtermPro.GetScreenText(1, 1, 24, 80))) 'however Powerterm does not use Range, instead Col & Rows, I don't know the correct syntax
'If test is not found
What do I do?
'If Rng Is Nothing Then
Prompt = "ABN Test Not Found """ & AbnTest & """ not found," & " press ESC to exit"
Else
What do I do?
End If
Prompt = Prompt & vbLf
Loop
Exit Sub
End Sub
please have a look at this screenshot
(imgur. com/a/QmTqr) the workflow example. Hopefully this can help you understand better exactly what it is that I'm trying to accomplish. Also if you could stair me in the right direction as far as a working syntax that will at least allow me to build from. I guess it doesn't' have to be the exact code, but somewhere near the correct language that I am trying to speak, if this was a language, I am asking you basically how to correctly write a sentence (if that makes sense).
18714
I have also included some links that explain allot of PowerTerm's vba expressions, methods, etc. if you care to read
ericom. com/doc/pro/Chapter_4b.asp
ericom. com/doc/pro/Chapter_4c.asp
ericom. com/doc/TechnicalReferences/PTPSLReference.pdf
ericom. com/doc/pro/Chapter_4d.asp
Sub Test()
Dim RetValue As String
Dim Prompt As String
Dim Rng As Range
With Sheets("BDEscreen")
Do While True
RetValue = InputBox(Prompt:="Enter ABN Test", Title:="Optum360 TM", Xpos:=3090, YPos:=10500)
'If no test entered
If RetValue = "" Then
Call ReturnToBDE
Call SendKeyNumOff
DoEvents
Exit Do
End If
'If test is found
Set Rng = .Columns("B:B").Cells.Find(What:=RetValue, After:=.Range("B9"), LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
'If test is not found
If Rng Is Nothing Then
Prompt = "Test """ & RetValue & """ not found," & " press ESC to exit"
Range("b31").Value = RetValue
DoEvents
Else
Range("b31").Value = RetValue
Call ReturnToBDE
DoEvents
End If
Prompt = Prompt & vbLf
Loop
End With
Exit Sub
End Sub
So for the last 2 months I have been searching every website that I possibly could and unfortunately I cannot find anything to help me with recreating this within the Powerterm application. Below is the code that I tried to recreate using the powerterm methods, but I just can't do it. Please help...
Sub Testbeta()
Dim AbnTest As String
Dim Prompt As String
Dim Rng As Object
PtermPro.Application.Setup.EmulationType = ptVt320_7
Do While True
AbnTest = InputBox(Prompt:="Enter ABN Test", Title:="Optum360 TM", Xpos:=3090, YPos:=10500) 'this works fine
'If no test entered
If AbnTest = "" Then
Call ReturnToBDE
Exit Do
End If
'If test is found
Rng = PtermPro.Application.VBA.Trim(CStr(PtermPro.GetScreenText(1, 1, 24, 80))) 'however Powerterm does not use Range, instead Col & Rows, I don't know the correct syntax
'If test is not found
What do I do?
'If Rng Is Nothing Then
Prompt = "ABN Test Not Found """ & AbnTest & """ not found," & " press ESC to exit"
Else
What do I do?
End If
Prompt = Prompt & vbLf
Loop
Exit Sub
End Sub
please have a look at this screenshot
(imgur. com/a/QmTqr) the workflow example. Hopefully this can help you understand better exactly what it is that I'm trying to accomplish. Also if you could stair me in the right direction as far as a working syntax that will at least allow me to build from. I guess it doesn't' have to be the exact code, but somewhere near the correct language that I am trying to speak, if this was a language, I am asking you basically how to correctly write a sentence (if that makes sense).
18714
I have also included some links that explain allot of PowerTerm's vba expressions, methods, etc. if you care to read
ericom. com/doc/pro/Chapter_4b.asp
ericom. com/doc/pro/Chapter_4c.asp
ericom. com/doc/TechnicalReferences/PTPSLReference.pdf
ericom. com/doc/pro/Chapter_4d.asp