INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

I can't create a simple VBA macro to search and find

I can't create a simple VBA macro to search and find

(OP)
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:

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) '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 

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

RE: I can't create a simple VBA macro to search and find

hi,

Quote:

I am billing coder with aspirations of becoming a programmer one day.

I had a similar experience. I grew up and learned to become a programmer. I was 40ish when I really began to learn. About 55 when I discovered Excel VBA and six years later discovered Tek-Tips and things took off! You can learn a lot here.

I also learned to scrape an IBM 3270 terminal emulator (Attachmate!Extra). So I coded in Excel VBA, primarily because 1) my driver data and result data needed to be in Excel and 2) the Excel VB Editor was light years better than the Extra VB editor. It's like the difference between driving a Porsche and a Vega.

I have no idea what the Powerterm Object Model is, but you'll need to learn that. Can give you some general help VBA but not specific help.

What specifically do you need?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

Quote:

I would like to ditch using excel and "recreate" the macro that I was using in excel, in Powerterm Pro

So what will be the output product of your program in Powerterm?

In my world, I'd have a list of items to access via a screen/transaction on the emulator and for each item, one or more associated items to report back to a user. So I needed a spreadsheet in almost all instances.

So I had a table that described the fields on each and every screen and a bunch of supporting functions, to be able to scrape every data field on each screen and create a row in a table for that screen that contained all the data fields. Couldn't do that with just an Extra VB program nor just a powerterm program, I'd guess.

Quote:

In the past I figured out how to copy screen data via the emulation screen (vt3020-7) and paste it to excel
If you were to grab each data field and put in a table rather than copy/paste a screen, a table is much simpler to analyze than a screen copy.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
Thank you for your awesome reply Skip! How you were at 40 is exactly how I am at 38 smile (concerning programming). Skip please have a look at this screenshot of 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).
Click here for a larger size

RE: I can't create a simple VBA macro to search and find

Okay I see (left to right) a terminal screen that I'm guessing is a Powerterm input screen, the middle panel is a patient form, the data of which you need to enter into our mainframe patient tracking system and the right panel is Excel that you currently use.

But all that has no bearing on the language needed.

So how do you propose to get the text off the patient form and into the Powerterm screen?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
I don't really need to copy/paste the data since it's already there. I guess what I'm looking for is:
1. a way to enter a numeric value (test code)
2. have it search/compare via on screen data
3. move the cursor position to the corresponding 1-15 "No. selection",
4. left button click to highlight (in which will automatically copy that number)

And from this point, I can paste the copied value accordingly and thus one test successfully entered.

RE: I can't create a simple VBA macro to search and find

1. a way to enter a numeric value (test code)

Do you mean a way other than typing the number from the form into the Optum360 TM box?

Where does 34429 come from?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
From the emulation screen (powerterm), simply entering a test code (IE 34429)is prohibited, instead you are expected to find the test code on the imaged requisition (2nd screen aka image viewer) and select the corresponding code by selecting the 1-15 number (only options to enter are 1-15). When there are allot of codes to match, this can become very tedious. I am trying to bypass this old method by entering the test code and automate a method to select the corresponding No. rather than manually doing it.

RE: I can't create a simple VBA macro to search and find

So the second image is the image viewer? So you actually SELECT text on this Powerterm screen and then what?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
Correct (image viewer), the Optum box is the input boxe I created and intend to pass the numeric vals (tests) to the emu screen. So after the test is selected, the next ordered test is selected (1<enter>, 4<enter>,etc)and then the req is processed and powerterm pulls the next req to be processed.

RE: I can't create a simple VBA macro to search and find

So the user must select each test from the image viewer and then issue a requisition.

So how is a coded solution supposed to work?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

Are ALL the tests available for EVERYONE contained on ONE screen of 15 items?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
The test are scraped via the initial data input via the lab, after the laboratory work is processed (blood work, urine samples, imaging of reqs, etc) then once the information is imaged, our billing department pulls from various ques to be coded and eventually billed. So each req will populate tests that are ordered from the client, at the billing stage, the purpose of reentering the tests are for verification and confirmation purposes.

RE: I can't create a simple VBA macro to search and find

I'm trying to figure out the process.

You have 15 tests on one screen. Is that just for this patient?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: I can't create a simple VBA macro to search and find

(OP)
Yes you are correct, each requisition is a representation of one patient. If the doctor ordered 3 test to be performed for the patient then 3 test will be ordered (Hospital etc), performed (via the lab) and billed (via my department, the billing dept).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close