Contact US

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.

Students Click Here

Need a help to gather text from MyExtra to Word 2002 (Easy?)

Need a help to gather text from MyExtra to Word 2002 (Easy?)

Need a help to gather text from MyExtra to Word 2002 (Easy?)

I need some help with a macro that does following:

1: In Attachmate (MyExtra) Select words on specific fields and store them as (example) X1, next word on another specific field X2, etc.

2. Open up an existing word file on the drive and the stored information will be inserted in the (word) file and following order:
Example: The word for X1: should come after: "My name is " X1
Next row; "My adress is " X2, etc.

3.Print out the word file and close without saving.

Thanks in advance
Best Regards

RE: Need a help to gather text from MyExtra to Word 2002 (Easy?)


I'm not a Word VBA programmer, so you might need specific help for Word VBA in forum707: VBA Visual Basic for Applications (Microsoft).

But first, you must set an application object for MS Word, using CreateObject and then open your document, using that object.  Manipulating the data within MS Word, will entail using the MS Word Object Model, for which you can get help in forum707: VBA Visual Basic for Applications (Microsoft).


glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Need a help to gather text from MyExtra to Word 2002 (Easy?)

Groom84 - did you get your answer?

Here is the code from an Extra macro that takes fields from a screen and populates them into a Word document.  I hope this helps.

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Declare Function MyFunction()

Sub Main
   call MyFunction()

End Sub

Function MyFunction()
    Dim wrd As Object
    Dim Session As Object
    Dim System As Object
    Dim MyScreen as Object
    Dim TextFound as String
    Dim ClientID as String
    Dim FirstName as String
    Dim LastName as String
    Dim StreetNumber as String
    Dim StreetName as String
    Dim StreetType as String
    Dim StreetAPT as String
    Dim City as String
    Dim State as String
    Dim Zip as String
    Set System   = CreateObject("EXTRA.System")
    Set Session = System.ActiveSession
    Set MyScreen = Session.Screen

'Scrape the data from the host screen.    
        ClientID  = MyScreen.GetString(4,38,9)
        FirstName  = MyScreen.GetString(5,13,13)
        LastName  = MyScreen.GetString(5,53,18)
        StreetNumber = MyScreen.GetString(12,10,12)
        StreetName = MyScreen.GetString(12,23,22)
        StreetType = MyScreen.GetString(12,46,7)
        StreetAPT = MyScreen.GetString(12,54,10)
        City  = MyScreen.GetString(13,7,22)
        State  = MyScreen.GetString(13,34,2)
        Zip  = MyScreen.GetString(13,43,10)
'Format the Host text to use lowercase characters

        FirstName = left(FirstName,1) + lcase(right(FirstName,len(FirstName)-1))
        LastName = left(LastName,1) + lcase(right(LastName,len(LastName)-1))
        StreetName = left(StreetName,1) + lcase(right(StreetName,len(StreetName)-1))
        StreetType = left(StreetType,1) + lcase(right(StreetType,len(StreetType)-1))
        City = left(City,1) + lcase(right(City,len(City)-1))
'Insert the host information into the MS Word document    
    Set wrd = CreateObject("Word.application")
    wrd.Documents.Open "C:\Documents and Settings\All Users\Documents\FSET_CLASS_Attm.doc"
    wrd.Visible = True
    wrd.ActiveDocument.CustomerName.Caption= Trim(FirstName) & " " & LastName
    wrd.ActiveDocument.CustomerAddress.Caption= Trim(StreetNumber) & " " & Trim(StreetName) & " " & Trim(StreetType) & Trim(StreetAPT)
    wrd.ActiveDocument.CityStateZip.Caption= Trim(City) & ", " & Trim(State) & "  " & Zip
    wrd.ActiveDocument.Today.Caption= format (DATE, "mmmm dd, yyyy")
    wrd.ActiveDocument.ClientID.Caption= Trim(ClientID)
    Set wrd = Nothing
end Function

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! Already a Member? Login

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