Consulting

Results 1 to 5 of 5

Thread: edit notepad

  1. #1

    edit notepad

    I am a newbie to vba.
    I new to edit a notepad with vba excel. I have to replace few strings with my new ones.
    please !!

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Welcome to VBAX
    Check out ReadLine and associated items in VBA help. If you can post a sample showing what you want to do, that would help. Use Manage Attachments in the Go Advanced reply section. You may have to zip a txt file.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Hi thanks for replay!!!

    Please see the uploaded file

    here is what i want to do...

    I have to replace the block of strings from
    Line 22:- ~ Select `file_open` `Ph_list.Filelist` \

    to

    Line41:- 1 `test.prt`

    to give the new path and file name...

    this has to done through ExcelVBA..

    Also I need to copy a block of lines from notepad and paste it in another location in same notepad...

    To put in a nut shell I need to completly edit the notepad and save the it in the same name,format and location.

    If possible please give a sample code with function to
    1.Open the txt file
    2.read the lines from notepad as strings (or) delete the contents of the notepad
    3.Write(overwrite) strings in the notepad as new lines
    4. save the file in same format and close.

    I will work out the logic....
    Please help...

    I am working on the hints u gave me.. tanks 4 that...
    Last edited by dhananjay; 12-15-2008 at 07:55 PM.

  4. #4
    hi friends I have worded out the logic....

    But please give me sample code with funtions for

    1. open a txt file.
    2.Delete contents
    3.write the lines
    4. save and close

    Eg.
    input: test.txt
    dhananjay

  5. #5
    hi friends I have worked out the logic....

    But please give me sample code with funtions for

    1. open a txt file.
    2.Delete contents
    3.write the lines
    4. save in UTF-8 format and close

    Eg.
    input: test.txt
    vbax
    is
    a
    great forum
    Output: test.txt
    I
    am
    learning
    a lot
    here
    Last edited by dhananjay; 12-16-2008 at 12:17 AM.

Posting Permissions

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