User Form


Posted by Simon Mc on June 06, 2001 12:50 AM

Hi,

I need to create a user input form that contains two pieces of information.

1. Reference number
2. Status

The results of the input need to be input into a csv file called results.csv.

Does anybody have any experience in this sort of thing or am I being a bit ambitious.

Thanks
Simon

Posted by Doug on June 06, 2001 5:46 AM

Can't you just make a button and inside the button code do a
Open "C:\test.csv" for append as #1
append box1name, box2name, box3name
close #1
or will that not work? just thought i'd try to help.

Posted by Simon Mc on June 06, 2001 11:05 PM

All the boxes will appear in the same cell. How would you separate them into columns. for instance, Box 1 will be the Identity number and Box 2 will be the Status of OK or NOK. These two entities ie the identity number and the Status need to be in separate columns but on the same row. I may have to input 100 of these Identity numbers with status at any one time to my csv file via the customer form. Any Ideas!

Thanks
Simon




Posted by Damon Ostrander on June 07, 2001 10:52 PM

Hello Simon,

What you are trying to do is very easy. The VBA Write # statement is for generating csv files. Simply open the file using the VBA Open statement, write the two values using the Write # statement, and close the file. Your code should look something like this:

Open "c:\My Documents\results.csv" For Output As #1

Write #1, txtRefNo.Value, txtStatus.Value

Close #1

This code would probably reside in your form's OK button click event. I'm assuming in this example that the Reference number and status are entered in TextBoxes named txtRefNo and txtStatus, but could be in worksheet cells, dropdown listbox selections, or whatever.

Happy computing.

Damon