Humbled_Guy
Programmer
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:
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...
I have also included some links that explain allot of PowerTerm's vba expressions, methods, etc. if you care to read
VBA Commands by Category
Programmer’s Reference
PowerTerm Pro VBA Sample Scripts
Code:
Option Explicit
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...
Code:
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) [COLOR=#73D216]'this works fine[/color]
'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))) [COLOR=#CC0000]'however Powerterm does not use Range, instead Col & Rows, I don't know the correct syntax[/color]
'If test is not found
[COLOR=#EF2929]What do I do?[/color]
'If Rng Is Nothing Then
Prompt = "ABN Test Not Found """ & AbnTest & """ not found," & " press ESC to exit"
Else
[COLOR=#EF2929]What do I do?[/color]
End If
Prompt = Prompt & vbLf
Loop
Exit Sub
End Sub
I have also included some links that explain allot of PowerTerm's vba expressions, methods, etc. if you care to read
VBA Commands by Category
Programmer’s Reference
PowerTerm Pro VBA Sample Scripts