vba - Is there a way to simply write data to a file using visual basic -
i'm designing application using visual basic , xaml, , wondering if there "easy" way read/write data file. application going need remember few variables (preferably stored in array) on start up.
from microsoft:
sub openexample() dim sfirst, slast, saddress, scity, sstate, szip string '' create data file '' open file input. open "datafile.txt" output #1 '' write data file. write #1, "john", "doe", "an address", "a city", "a state", "a zip" '' close file. close #1 '' retrieve data file '' open file input. open "datafile.txt" input #1 '' loop until end of file reached. while not eof(1) '' read data variables. input #1, sfirst,slast,saddress,scity,sstate,szip '' print data debug window. debug.print sfirst,slast,saddress,scity,sstate,szip loop '' close file. close #1 end sub
from http://support.microsoft.com/kb/209231
found using google search term "microsoft vba open output".
Comments
Post a Comment