PDA

View Full Version : edit notepad



dhananjay
12-13-2008, 05:06 AM
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:help !!

mdmackillop
12-13-2008, 05:52 AM
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.

dhananjay
12-14-2008, 11:58 PM
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...:friends:

dhananjay
12-15-2008, 08:04 PM
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

dhananjay
12-15-2008, 08:07 PM
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