Output to a text file.

megnin

Active Member
Joined
Feb 27, 2002
Messages
340
How can I get output from combo box selections to populate a plain text file?

I need a string of comma delimited text as output from several combo boxes.

Thanks.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

JohnG

Board Regular
Joined
Feb 18, 2002
Messages
165
First you need to open the text file for output in the form :-
Open pathname For mode [Write] [lock] As [#]filenumber [Len=reclength]

The take data from a textbox's to a variable with comma delimiter.
Tempvar=textbox1.value & ", " & textbox2.value & ", " & textbox3.value etc

Finally write variable
Write #1 Tempvar

Don't forget to close file at the end.
 

megnin

Active Member
Joined
Feb 27, 2002
Messages
340
That's a bit over my head. I'm not a programmer. I do well to get the combo boxes to do what I want :)

Additionally I need this to be totally automated because it's going to be used in our South American region by people running Excel 5.0/95.

I'm not sure if the text file is my only option. If I'm lucky I can use a text box. I'm still waiting for specs on the format the output has to be in.

If they can cut and past the output into their tool then I should be able to use a text box.

They wanted me to put the entire list in one cell but Excel 5.0/95 only supports 255 characters in a single cell.

Any advise is greatly appreciated!!
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,396
Office Version
  1. 365
Platform
  1. Windows
I'm not sure if this will help you, but I did something a little like this. What I did was I had a command button for them to push when they were done. The command button would take the values entered on sheet one (that had combo boxes and manual entries) and create the data file on sheet two, inserting commas where necessary. Then it would save sheet two as a comma separated file.

Either way, you'll porbably have to use a little VBA.
 

megnin

Active Member
Joined
Feb 27, 2002
Messages
340
That sounds like just the ticket. How did you get it to save as a comma separated file?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,396
Office Version
  1. 365
Platform
  1. Windows
What I actually did was create the file on sheet 2 and save it as a ".prn" file (text file).

For example, in cell A1, I created a string (inserting the commas where necessary) something like the following:

[combo box 1] & "," & [combo box 2] & "," & etc.

I then would repeat it for cell A2, A3, etc. until I have completed writing all of my data. Then I saved it as a ".prn" file which, because I inserted the commas, is really a Comma Separated Value file.
 

Forum statistics

Threads
1,143,641
Messages
5,719,988
Members
422,257
Latest member
Calion

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top