View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Start me in the right direction, please

Hi Bill
if this works for you than yout go with it :-)
Nothing wrong with the code.

--
Regards
Frank Kabel
Frankfurt, Germany


Bill Allen wrote:
Thanks, Frank.

But, I _really_ do want to use Excel.
Two reasons:
1. I want to use Excel for preprocessing purposes.
2. I don't know Perl (or just about anything else, for that

matter,
besides enough VB to get me in trouble).

I *think* I've found out how to do what I want.
Tell me what you think:

Public Sub CreateFile()
Open ThisWorkbook.Path & "\example.txt" For Output As #1
Print #1, "Blah, blah, blah"
Print #1, "Blah, blah, blah"
Print #1, "Blah, blah, blah"
.
.
.
'the "Blah, blah, blah" lines are those that don't change from one
file to the other. No reason to put them in the spreadsheet.)
.
.
.
Print #1, Format(Str(Range("C4").Value), "#.0"); " ";
Print #1, Format(Str(Range("C5").Value), "#.0"); " ";
Print #1, "0.0"
.
.
.
'these are the parts of the input file which change. Cells C4 and C5
have the values formatted properly to be read by the other program.
.
.
.
Close #1
End Sub

Anything wrong with that?

Thanks,
Bill

"Frank Kabel" wrote in message
...
Hi Bill
you may provide some more details :-)
BUT in general I won't use Excel to create a text file. You may
consider a scripting language like PERL but this depends on what
you're really trying to do

--
Regards
Frank Kabel
Frankfurt, Germany


Bill Allen wrote:
I'm NOT a programmer, but...

this *shouldn't* be too difficult, even for me.

An input file I create for another program is a text file. Most of
the lines are the same with every run. My goal is to use Excel to
"pre-process" that input file and then save it.

Can someone either tell me:
a.) the command structure for a routine to do this or,
b.) give me a good reference so that I don't spend my time going
down the wrong path?

Of course, the next step would be to execute that other program

from
within Excel and then bring back the results into my spreadsheet,
but I'm getting ahead of myself.

TIA,

Bill