Thank you very much for that Tony. I appreciate the effort. I will certainly look this over and learn from it. I have a quick question, I think it may be simple, and perhaps it is already in the example code you sent along (excuse me if so, but I have someone who needs this feature last week and it may take me some time to find it).... Is there a real simple way to get Excel to automatically copy the contents of a cell to another cell every time the first cell is updated or changed. Thanks again! John ----- Original Message ----- From: "Tony Smith" To: "Microcontroller discussion list - Public." Sent: Saturday, July 09, 2005 8:30 AM Subject: RE: [OT] Book recommendations for VBA > Hi John, > > You won't find any info on DDE in recent books, that's fairly old stuff. I had a look thru my book collection, a book on VB4 gave > it an entire paragraph. Another book, "Developing Applications with MS Office", (published in 1995 and referring to Office V4) has > a short chapter, amusing called "DDE: It's not dead yet!". > > The way I'd do it is to write a small VB app to handle the DDE, and write the data to a text file. An Excel spreadsheet can then > load & graph this text file. By decoupling the two tasks, it should be more reliable, and easier to upgrade in future. > > The zip I've attached has 2 files, an Excel sheet and a text file with dummy data. There's a little bit of VBA code, 4 lines > essentially. > > When you open the sheet, a macro triggers to load the data file, and refresh itself every second. With Excel still open, open the > .txt file, add/edit/delete, save and watch the sheet update. Neat, huh? > > Most of the hard work is done by Excel itself, hence the "learn Excel first" comment made previously. First, a Query is used to > load the data. Look at "Data / Get External Data / Import Text file". More than just "open file", this is essentially "Get * from > file.txt" as Excel treats it as just another data source. > > Second, named ranges are used to define where the data is (See Insert / Names / Define). Rather than refer to cells like A1, A2:A9, > you can give them names, just like variable names. > > Take this one step further by using formulas, you get what's called self-expanding ranges. As the number of rows changes, so does > the area defined by the named ranges. In this case, I've called them X_Values & Y_Values. > > Since the chart refers to the named ranges, it's guaranteed to include all the data points. > > The macros are simple. On opening, the path where the data file resides is fixed (Connection string). Next, the Query to get the > data is refreshed (chart updates automatically). Finally, a curious item in Excel, the OnTime method, is used. This lets you > program a Date & Time for when a macro will run. In this case, we want to re-run this macro in one seconds time. Upon closing, > this timer is disabled. > > Note that the query can be set to refresh itself, but the minimum interval is 1 minute. By using that, you don't need the macros. > (Except perhaps to set the Connection string for the Query.) > > I'm sure this is completely different to what you envisaged! :-) > > Tony > > > > -----Original Message----- > > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu]On Behalf > > Of John Pearson > > Sent: Wednesday, 6 July 2005 12:11 AM > > To: Microcontroller discussion list - Public. > > Subject: Re: [OT] Book recommendations for VBA > > > > > > Thanks to all for the very usefull help. > > > > The data input is from another program via DDE. 2 to 5 values will arrive > > about every second or maybe 2. > > > > And thanks for the advice to learn Excel as I do not know Excel and that > > could save me some headaches to do so first. > > > > John > > > > ----- Original Message ----- > > From: "spiridon a. gkoutzamanis" > > To: "Microcontroller discussion list - Public." > > Sent: Tuesday, July 05, 2005 3:57 AM > > Subject: Re: [OT] Book recommendations for VBA > > > > > > > try "VBA for Dummies" > > > I Bought it and itisi quite good! > > > -- > ---------------------------------------------------------------------------- ---- > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist