ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to write to a template txt file (https://www.excelbanter.com/excel-programming/333833-how-write-template-txt-file.html)

pouk

How to write to a template txt file
 

Hi,
I am reading data from a row in a excel and need to write it to a
preexisting template file at specified points/lines. Would this be
possible as I am not very familiar with VB.

Simplistically, let's say i read data from the columns (A-F) of row 1:

A B C D E F
X Y Z 1 2 3

and need to write x,y,z,1,2,3 to specified lines of a text file after
doing some formatting to it (preceding x,y,z with certain characters)

File:
[__Header__]
ProductName = "lala "
ProductVersion = 1.1
Version = 120
Type = "type"

PATH=\"C:\\PATHNAME\\XY.TXT\"

data
data

%NAME = \"X\"

data
data

DURATION=2

etc.


Many Thanks :)


--
pouk
------------------------------------------------------------------------
pouk's Profile: http://www.excelforum.com/member.php...o&userid=24961
View this thread: http://www.excelforum.com/showthread...hreadid=385179


Dave Peterson[_5_]

How to write to a template txt file
 
JE McGimpsey has some nice code you can borrow and enhance at:
http://www.mcgimpsey.com/excel/textfiles.html

pouk wrote:

Hi,
I am reading data from a row in a excel and need to write it to a
preexisting template file at specified points/lines. Would this be
possible as I am not very familiar with VB.

Simplistically, let's say i read data from the columns (A-F) of row 1:

A B C D E F
X Y Z 1 2 3

and need to write x,y,z,1,2,3 to specified lines of a text file after
doing some formatting to it (preceding x,y,z with certain characters)

File:
[__Header__]
ProductName = "lala "
ProductVersion = 1.1
Version = 120
Type = "type"

PATH=\"C:\\PATHNAME\\XY.TXT\"

data
data

%NAME = \"X\"

data
data

DURATION=2

etc.

Many Thanks :)

--
pouk
------------------------------------------------------------------------
pouk's Profile: http://www.excelforum.com/member.php...o&userid=24961
View this thread: http://www.excelforum.com/showthread...hreadid=385179


--

Dave Peterson


All times are GMT +1. The time now is 01:13 AM.

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