ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there an easy way to open a text file and modify only a part of it? (https://www.excelbanter.com/excel-programming/390320-there-easy-way-open-text-file-modify-only-part.html)

muster

Is there an easy way to open a text file and modify only a part of it?
 
now I open the file and copy it to another file line by line and
change lines need to be changed.

Is there an easy way? It looks like an INI file but not really is a
INI file.

Thank you,


NickHK

Is there an easy way to open a text file and modify only a part of it?
 
It depends on the format that you require and what Excel can give you.
You could open and edit in Excel then save as text.

If it has an INI file structure you can use the API calls like
GetPrivateProfileString:
http://vbnet.mvps.org/code/file/pprofilebasic.htm

Otherwise you would need to read the whole file into a string/array. Make
the changes. Write the whole file to a new file. Kill the old.

NickHK

"muster" wrote in message
oups.com...
now I open the file and copy it to another file line by line and
change lines need to be changed.

Is there an easy way? It looks like an INI file but not really is a
INI file.

Thank you,





All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com