Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start me in the right direction, please
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start me in the right direction, please
Bill,
If I understand you correctly, you want to use Excel to read or create and then save a text file for input to another program. To import a text file into Excel, just use the File -- Open... menu path, and select "All Files (*.*)" in the "Files of type" drop-down list. The Text Import Wizard will pop up and guide you through the steps. To save a worksheet as a text file, use the File -- Save as... menu path, and select one of the several text options in the "Save as type" drop-down list. Regards, Wes |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start me in the right direction, please
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Start me in the right direction, please
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Direction | New Users to Excel | |||
Need direction | Excel Discussion (Misc queries) | |||
OT :Start your own online business today !start making dollars | Excel Discussion (Misc queries) | |||
I need direction | Excel Discussion (Misc queries) | |||
Start spreadsheet with WinXP start | Excel Worksheet Functions |