Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Just a quick note to say, "THANKS!" for these forums...The site is very well layed out and easy to use. Thanks for bringing us together - we need each other."

Geography

Where in the world do Tek-Tips members come from?
MikeB1986 (IS/IT--Management)
1 Aug 12 14:21
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.
Lakare (Programmer)
2 Aug 12 4:57
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

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!

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