Visual Basic Programmin

Posted on 2011-02-23
Last Modified: 2013-11-26
I am trying to modify an existing macro. The existing macro automaticall puts in today's date. I want to add to the macro. I want it to also put in a some more text, the user's first initial and last name, thier unit code, job title and office code . For Example: 02/23/11 jtalbott Job tile: TSR Office : E14 Unit: 3311.
Here is the existing macor:
DESCRIPTION=Today's Date mmddyy


REM Created by Bill Louden, Seattle RO.  Last modified 01/03/05 at 9:01 AM PT.
REM Types the current 6-digit date at whatever point the cursor is placed.
REM ------------------------------------------------------------------------------------------------
      REM Declare the objects
      REM ECLPS is the (P)resentation (S)pace
      REM ECLSession is the Session
      REM ECLOIA is the (O)peration (I)nformation (A)rea

Dim objautECLPS
Dim objautECLSession
Dim objautECLOIA
Dim sysObj
Dim DateToday
Dim DateMonth
Dim DateDay
Dim DateYear
Dim CurPosRow
Dim CurPosCol

      REM Set and activate the objects

Set objautECLPS = CreateObject("PCOMM.autECLPS")

Set objautECLSession = CreateObject("PCOMM.autECLSession")

Set objautECLOIA = CreateObject("PCOMM.autECLOIA")

Set sysObj = CreateObject("PCOMM.autSystem")

sub subSub1_()

If objautECLPS.getText(2, 64, 6) = "TERMID" then

            REM Check to see if user is on the SSA MAIN MENU.

      MsgBox "Please Login first.",, "User Not Logged In"

      Exit Sub

ElseIf objautECLPS.getText(2, 77, 4) = "CIGN" Then

            REM Check to see if user is on the Welcome/Login screen.

      MsgBox "Please Login first.",,"User Not Logged In"

      Exit Sub

ElseIf objautECLPS.getText(1, 11, 53) = "Enter Password To Unlock; CESF Or Clearkey To Signoff" Then

            REM Check to see if user is locked out (but logged in).

      MsgBox "Mainframe is locked:  Password required." & Chr(13) & "Enter your password and try again." , ,"User Locked Out"

      Exit Sub

      CurPosRow = objautECLPS.CursorPosRow
      CurPosCol = objautECLPS.CursorPosCol
      DateMonth = Month(date)      
      DateDay = Day(date)
      DateYear = Year(date)      

      If DateMonth < 10 Then
            DateMonth = "0" & DateMonth
      End If
      If DateDay < 10 Then
            DateDay = "0" & DateDay
      End If
      DateYear = Mid(DateYear, 3, 2)

      DateToday = DateMonth & DateDay & DateYear

      objautECLPS.sendkeys DateToday

      Set objautECLPS = Nothing
      Set objautECLSession = Nothing
      Set objautECLOIA = Nothing
      Set sysObj = Nothing
      Set DateToday = Nothing
      Set DateMonth = Nothing
      Set DateDay = Nothing
      Set DateYear = Nothing
      Set CurPosRow = Nothing
      Set CurPosCol = Nothing
      Exit Sub

End If

End Sub

HERE is a macor I recorded that shows what I want added to the exisitng macro:

REM This line calls the macro subroutine

sub subSub1_()
   autECLSession.autECLPS.SendKeys "E14 jtalbott TSR Office E14 Unit 3311"
end sub
Question by:jtalbott
  • 3
  • 2
LVL 34

Expert Comment

by:Gary Patterson
ID: 34963043
Just copy and paste the lines (excluding sub/end sub) that you recorded after the Sendkeys line in the original macro, I guess.

Author Comment

ID: 34963150
I do not see a send key.
LVL 34

Expert Comment

by:Gary Patterson
ID: 34963297
Then look again. :-)

Author Comment

ID: 34963911
Gatcha. thanks
LVL 34

Accepted Solution

Gary Patterson earned 500 total points
ID: 34963993
After this line in the original script:

  objautECLPS.sendkeys DateToday

Paste these lines from your recorded macro:

   autECLSession.autECLPS.SendKeys "E14 jtalbott TSR Office E14 Unit 3311"

And now the macro will:

Send the characters in the DateToday variable to the current screen.
Wat for the application to return to "Available" status
Wait for the emulator session to return to "Input Ready" status
Send "E14 jtalbott TSR Office E14 Unit 3311" to the current screen.

- Gary Patterson


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now