×
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!
  • Students Click Here

*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

Jobs

Macro to go between EXTRA and notepad

Macro to go between EXTRA and notepad

Macro to go between EXTRA and notepad

(OP)
Hello everyone,
First I would like to thank everyone in advance. Now onto my question. I work in the I.T. Dept of a large company, and we use attachmate extra xtreme for our backend. What I would like is a macro that could jump from extra to notepad, copy a line of text, delete the text it copied, delete the blank space it left so the next line will take its position, then jump back into extra. I know it would be better with pretty much anything other than notepad, but it was made very clear to me that I can only use what is on the PC. Also the file being native to notepad makes it easier anyways. I already have a macro that will run the rest. I just need one that will do what was previously requested. Also if it is any help the line in the notepad that will be copid is 14 characters long. Again I appreciate any help or advice on this. Thank you.

RE: Macro to go between EXTRA and notepad

I'm sure there is a better way to do it, but this function takes a line number as input and returns the extracted line.

CODE

Declare Function extractline(lineNumber)

Function extractline(lineNumber)

    filename = "<filename>"

    OPEN filename For Input As #1
    
    Dim i as integer
    
    i = 0
    
'Count the number of lines
    Do while EOF(1) <> True
        Input #1, txtline
        i = i + 1
    Loop
    
    CLOSE
    
    If i < lineNumber Then
        Exit function
    End If
    
'Copy the lines into a list
    OPEN filename For Input As #1
    
    Dim lines() as String
    reDim lines(i)
    
    For j = 1 To i
        Input #1, lines(j)
    Next
    
    CLOSE
    
'Rewrite the file without the line needed
    OPEN filename For Output As #1
    
    For j = 1 To i
        If j <> lineNumber Then
            Print #1, lines(j)
        End If
    Next
    
    CLOSE
    
'Return the line extracted
    extractline = lines(lineNumber)
    
End Function 

I need to copy the entire file and rewrite it because I don't know if it is possible to edit inside a txt-file.

Hope it helps.
Lakare

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