473,388 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

adding the text box output to a txt file or excel sheet

1
Please help

im new at VB & programming in general, and im creating a program to output the text to a excel sheet or to a normal text file, in wordpad, the design of the program is 100% but i have no clue on how to go about going about this, could someone please help this dummie!!!

and i know im trying my luck here, but i also need to find out how to make the program work in such a way that, each time someone opens it, a Unique code is generated. even if its like 01, 02 , 03 , 04, 05, 06,etc

Please help again, thank you
Dec 4 '06 #1
4 2341
Please help

im new at VB & programming in general, and im creating a program to output the text to a excel sheet or to a normal text file, in wordpad, the design of the program is 100% but i have no clue on how to go about going about this, could someone please help this dummie!!!

and i know im trying my luck here, but i also need to find out how to make the program work in such a way that, each time someone opens it, a Unique code is generated. even if its like 01, 02 , 03 , 04, 05, 06,etc

Please help again, thank you
You can use FileSystemObject and TextStream to get this done. Add Scripting Runtime refrence.

You can use Filesystemobject to create a text file or an excel file (preferably a CSV file) and your textstream for writing lines to the text file. If you are using a CSV file output format, use comma(,) as seperator.

Dim fsr As New FileSystemObject
Dim rsLog As TextStream
fsr.CreateTextFile (SaveFileName) ' SaveFilename specify the path where you would like to save the file, you can use commondialog control
Set rsLog = fsr.OpenTextFile(LogFileName, ForReading)

rslog.WriteLine("your text goes here")

finally after you are done,
close the file.

rslog.Close


All the best!
Padhu
Dec 5 '06 #2
You can use FileSystemObject and TextStream to get this done. Add Scripting Runtime refrence.

You can use Filesystemobject to create a text file or an excel file (preferably a CSV file) and your textstream for writing lines to the text file. If you are using a CSV file output format, use comma(,) as seperator.

Dim fsr As New FileSystemObject
Dim rsLog As TextStream
fsr.CreateTextFile (SaveFileName) ' SaveFilename specify the path where you would like to save the file, you can use commondialog control
Set rsLog = fsr.OpenTextFile(LogFileName, ForReading)

rslog.WriteLine("your text goes here")

finally after you are done,
close the file.

rslog.Close


All the best!
Padhu

Add "Microsoft Scripting Runtime" from your References
Dec 5 '06 #3
mharry
5
Add "Microsoft Scripting Runtime" from your References
I'm no expert but you can't use fso and open a file for reading and then write to it. You can only write to a file by opening it to write or append. You can however read the file (or line) into a var. and then close the file and write the contents to another file.
-m
Dec 6 '06 #4
I'm no expert but you can't use fso and open a file for reading and then write to it. You can only write to a file by opening it to write or append. You can however read the file (or line) into a var. and then close the file and write the contents to another file.
-m
thanks harry... i was reading and writing to same file. Instead, what can be done, you can write to a temp file from the original and then delete of the orginal and rename the created to the original name. as such, reading and writing on same file is not possible at the same time
Dec 7 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: hokiegal99 | last post by:
I've written a small script (with much help from this list) that searches through a directory for files without a PC filename extension like .doc .xls and then adds them. The reason for writing the...
0
by: dgoel | last post by:
Hi, I Have a text file & I want to open it in excel sheet ( withou importing). I have written code for it, but it is not opening exce sheet. It opens the text file, but does not create a excel...
3
by: OhMyGaw | last post by:
Hello Excel/automation Gurus, I am working on an application where I have to keep a centralized database of all macros distributed to user and save the changes back on a nightly basis back to...
4
by: e.h.doxtator | last post by:
All I'm a Python newbie, and I'm just getting to the wonders of COM programming. I am trying to programmatically do the following: 1. Activate Excel 2. Add a Workbook 3. Add a Worksheet...
3
by: saragoesnuts | last post by:
I have a program that automates to Excel with information in tables. I want to add charts to the excel file (pie charts, bar charts, etc). Is this possible?
5
by: nkechifesie | last post by:
Hi, I have written a VBA program that runs on Excel and puts data on the excel sheet. This runs everyday. I want to be adding the dates to the files, this date is gotten from the excel sheet that...
0
by: veer | last post by:
hello expert i am facing a probleum of saving the out put in excel sheet actually i have two buttons on my vb form i,e merge entery and merge verify and when i execute my program one by one...
2
by: pulavarthipraveen | last post by:
Overview: We have a requirement in the c#.NET 1.0 windows application. There will be some input text file in the user’s machine. The user should browse and select the input text file and also select...
0
by: sivadhanekula | last post by:
Hi all, I have to do a project in excel by usung vb. The coding part is done and I am getting the output in .CSV format. when doing project in the main excel sheet I will be having 3 sheets and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.