Results 1 to 4 of 4

Thread: cut lines of text(specific)

  1. #1

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    cut lines of text(specific)

    --------------------------------------------------------------------------------

    I cant seem to find how to simply select a certain number of lines, in a text.

    Dim PadId As Integer
    On Error Resume Next

    PadId = Shell("Notepad MyFile", 1)
    AppActivate(PadId)


    'select and cut lines 1 thru x. ??? I already have the line counter x.

    'paste elsewhere
    'save file
    'close file

    Thanks in advance!

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Do you have to do this with NotePad? It would be much easier to open the file within the VB code and process data there.

  3. #3

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    yes and no

    Well any example is nice but, I would prefer it done this way.
    Some temporary Internet files, and cookies do not always delete through microsoft code.

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    You could do this to cut the text,

    VB Code:
    1. Private Sub GetText(ByVal numOFlines As Integer, filename As String)
    2.  
    3. Dim strData As String
    4. Dim i       As Integer
    5. Dim slen    As String
    6.  
    7.     Open filename For Input As #1
    8.     For i = 1 To numOFlines
    9.         Line Input #1, slen
    10.         strData = strData & slen & vbCrLf
    11.     Next i
    12.     Close #1
    13.      
    14. End Sub

    To paste elsewhere just open a new file for output then print strData.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width