473,385 Members | 1,934 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,385 software developers and data experts.

Reading text file into excel automatically

How do i read a text file into excel automatically anytime the text file is updated. I have a text file that is updated every 100 times a minute from the hyperterminal text capture. I want to read it into excel 100 times a minute?
Nov 21 '06 #1
4 6678
Killer42
8,435 Expert 8TB
How do i read a text file into excel automatically anytime the text file is updated. I have a text file that is updated every 100 times a minute from the hyperterminal text capture. I want to read it into excel 100 times a minute?
Were you thinking of driving this from within Excel, or from a separate application, or what?
Nov 21 '06 #2
Killer42
8,435 Expert 8TB
At the simplest level, I suppose you could have a VBA macro in Excel which just keeps looping, issuing DoEvents to allow other things to happen, and checking the file once every however-often.

Here's something off the top of my head...
Expand|Select|Wrap|Line Numbers
  1. Public Sub DoSomething()
  2.   Const TimesPerSecond As Double = 100
  3.   Dim Interval As Double
  4.   Dim WaitUntil As Double
  5.   Interval = TimeValue("00:00:01") / TimesPerSecond
  6.   Do
  7.     WaitUntil = Now() + Interval
  8.     Do
  9.       DoEvents
  10.     Loop Until Now >= WaitUntil
  11.     ' Do your thing here...
  12.     Beep
  13.   Loop
  14. End Sub
There are probably heaps of things wrong with this, but it should be enough to illustrate the idea, anyway.
Nov 21 '06 #3
Thanks for the reply.I still have a little problem, I have not programmed with visual basic before but i need this for a small project. Is it possible for me to get a complete code of how I could load a text file, say ggg.txt 100 times per second into excel. That is anytime the file is updated it is uploaded into excel.

At the simplest level, I suppose you could have a VBA macro in Excel which just keeps looping, issuing DoEvents to allow other things to happen, and checking the file once every however-often.

Here's something off the top of my head...
Expand|Select|Wrap|Line Numbers
  1. Public Sub DoSomething()
  2.   Const TimesPerSecond As Double = 100
  3.   Dim Interval As Double
  4.   Dim WaitUntil As Double
  5.   Interval = TimeValue("00:00:01") / TimesPerSecond
  6.   Do
  7.     WaitUntil = Now() + Interval
  8.     Do
  9.       DoEvents
  10.     Loop Until Now >= WaitUntil
  11.     ' Do your thing here...
  12.     Beep
  13.   Loop
  14. End Sub
There are probably heaps of things wrong with this, but it should be enough to illustrate the idea, anyway.
Nov 27 '06 #4
Killer42
8,435 Expert 8TB
Thanks for the reply.I still have a little problem, I have not programmed with visual basic before but i need this for a small project. Is it possible for me to get a complete code of how I could load a text file, say ggg.txt 100 times per second into excel. That is anytime the file is updated it is uploaded into excel.
I think you need to be more specific about what you mean by "loaded". For example, if you were going to load it manually, would you
  • Simply open the file in Excel?
  • Paste the text over the top of existing data, replacing it?
  • Append the the text onto the end of existing data?
  • Load the text into a new worksheet within an existing workbook?
There are just too many options for the "what" for us to start advising you on the "how".
Nov 27 '06 #5

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

Similar topics

2
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It...
1
by: Hemanth | last post by:
Hello there, Could someone pls give me pointers (or examples) on how to use PHP (installed on a linux) to read & write MS Excel spreadsheets. So far I've been converting a spreadsheet to text...
6
by: Paul | last post by:
I was wondering if anyone has had an issue where using vba code to read an excel file and import the data into an access table some records are not imported from the excel file. It seems looking at...
1
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
2
by: sherifffruitfly | last post by:
Hi, I'm using an adaptation of excel-reading code that's all over the internet - I don't much like or understand it, but it has worked for me in the past.... beggars can't be choosers... : ...
1
by: Roy | last post by:
Hi all, Thanks for your replies.I have to develop an application which will read a .DAT file.There are several hundred records in this file.Also I get another excel file with adds and deletes....
2
by: =?Utf-8?B?a20=?= | last post by:
I have a tab delimited text file that I open in Excel. While it is open in Excel I need to open and read it from my C# application. I get an access error opening the file with StreamReader or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.