Click to See Complete Forum and Search --> : Transfer text into forms
subramm
Nov 24th, 2003, 03:22 AM
I have text in my file (.txt/.doc/.xls) with three columns of data, namely Sender,Subject and Message.
I also have a form on my application with these same fields. I do not wish to type these data from my file into the form everytime. My application is macro enabled and has been desgined with VB. I want to know whether i could transfer these data from text file onto the resp. fields in the form with a single click of a button.
steffy
Nov 24th, 2003, 02:01 PM
Dim FileNo As Integer
' Associate a number with file
FileNo=FreeFile
'Open file "path&filename" enter the complete path of you file
'For input and also be for output or for append.. but if you want to use the fields in your text file in your program you should use for input
Open path&filename For Input As #FileNo
'Loop till end of file
Do Until EOF(LoadFile)
'Input fields in text file into variables
Input #LoadFile, Field1, Field2, Field3, Field4
'if you need to save data for future use in program should probably use arrays if not can write additional statement in loop to display data
Loop
Text file must be delimited with commas... not comma at the end of the record. (i think its possible to delimite with quote(" ") but i haven't tried it yet. so i dont know if it works the same."
Also in my program i use a txt file. I'm not sure if it will for on doc file and as for xls files i think you have to create and open connection to it. Then read in the file
Sorry cant help more than that.. I'm new at this...
Steffy
subramm
Nov 24th, 2003, 09:59 PM
Thanks fo the reply, my application is macro enabled but i can only record macros. i cannot write VB code in it. so do i write this code in my excel sheet or on the application??
steffy
Nov 25th, 2003, 08:10 AM
I think you would write in your application... like if you wanna be able to transfer data from txt, doc and xls files.. into access you should create your macro in access... i hope that answers your questions cuz i didn't really understand what u wanted to know..
steffy
subramm
Nov 25th, 2003, 07:13 PM
I have an application in place which is used to record all faults. Some faults i get in through my email. What i do now is copy n paste each fault from my mail to the Appln system.
What i need to do is transfer the from,subject and message field from each mail into the fields in my appln system with a single clik rather than copying n pasting.
So far i have designed a macro in my outlook to transfer these fields from my mail into a text file with a single click.Now i need to transfer these frm my text file into the screen of the system with a single click, so that i dunt waste time going in and out of my inbox. Basically i want these text to just appear on the screen of my appln, with a single clik so that i click submit to log these text into my database thro my system.
biswajitdas
Nov 26th, 2003, 05:53 AM
hi
can you send me the coding on my mail.i solve your problem
i done before this
biswajit dsa
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.