In article <3736CFC7.A6DFAC8A@austin.rr.com>,
GMCKASKLE@austin.rr.com wrote:
> ... LabVIEW offers the chance to communicate easily with
> > MS Excel using the DDE protocol. The examples provided with the
LabVIEW
> > CD-ROM show how to open a file and how to write to specified cells.
But I
> > have three problems for which I can't find any clue:
> >
> > 1. How can I write to the row immediately after the last one
used ? Is
> > there a way to "call" the function COUNT that exists in Excel ? The
program
> > is supposed to be used for a lot of days but started only once a
day, we
> > don't want it to run forever . One option would be to write the
number of
> > rows used in a file and read it each time we initialize the
program, but
> > this doesn't seem a good idea since it writes "unknown" files to
disk.
> >
> > 2. When I want to write to the first cell of the first row the
channel
> > value to the poke vi is R1C1. The problem is that row in Portuguese
is
> > "linha" and I must put L1C1 if I'm using the Portuguese version of
Excel.
> > Is there a way to pass the channel value in an universal way, so
that the
> > version of Excel (English or Portuguese) doesn't matter ?
> >
> > 3. And, last but not least, is it possible to close Excel and
its sheets
> > and save the changes directly from LabVIEW using the DDE protocol ?
> >
>
> It may be possible to do each of these items with DDE and Excel, but
I don't
> know how, and most other people won't know how, and MS never
documented this
> very well. They have moved their inter-application control from DDE
to ActiveX
> Automation. It is documented, it is faster, and it is more
predictable.
>
> In your case, I get the feeling that you simply need to write to a
spreadsheet
> file. If this is the case, the easiest way is to produce a
> tab-delimited file
> using the builtin LV icons or formatting your own and writing the
text file.
>
> Excel will load these files, as will almost any other spreadsheet
> program, and
> assuming you don't need fancy items like sheets, it is much simpler
and faster
> than trying to control Excel to do your file I/O. If you do need the
> files to
> be in Excel binary format for some reason, you can have Excel load and
> save the
> file using ActiveX.
>
> Greg McKaskle
>
Why not save your data to a buffer sheet and use macro's to move the
data wherever you want. Once perfected you can then use DDE to repeat
those moacro's.
The DDE commands are identical to macro commands. (The old pre-visual
basic macro commands certainly do work). You can certainly use DDE
commands to close sheets but I have never tried using them to close
excel, it should work you can open it using DDE.
Rob Barker
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.