Saving Excel files from a SCADA HMI application.

M

Thread Starter

Mark Hutton

Hi folks!

Can anybody tell me, quickly, the best way to save an Excel file using an
external application?

I have a spreadsheet which is logging information from an RSView
application, I need to archive the file automatically on an event triggered
by a PLC, with a filename relating to the current date and time.

I could use Sendkeys, or trigger a VBA script in the workbook, but these
seem a bit complicated. I cannot seem to find the correct DDE command to
use.

Any help will be gratefully recieved.

Regards
Mark
 
M

Mark Fairbaugh

Mark,
you could send all the information you need recorded on the event to a
holding file (date, time, values , etc..).

So if the event happens then MOV all the values to an integer file.

Then using Excel and RSLinx (not RSLinx lite but the full version) you can
setup a DDE link and draw the information out at what evertime you want.
The PLC will store all the values until they are cleared. To ensure you
don't overwrite the values use a counter and indirect addressing to move
all the values needed on the second event to different words in the same
integer file or a different integer file.

Regards,


Mark Fairbaugh
PT Newmont Nusa Tenggara
Sr. Process Control Engineer
e-mail: [email protected]
 
D

David Bergeron

The best way is to use OLE automation. Excel exposes its
properties and methods allowing easy interface.

David Bergeron
TECO
 
M
I know that is the correct way to do it but it didn't work!

I could create a reference to a new instance of Excel and a new spreadsheet,
but could in no way get a reference to the existing and open spreadsheet. I
wasted the best part of a day, of two days allocated to the task in trying.

In the end I used a VBA script in the spreadsheet which was triggered by a
key press, I then used DDEExecute from RSView to provide the key press. For
some reason this didn't work until the spreedsheet got focus, so I used
AppActivate "Microsoft Excel" to give Excel the focus prior to the
DDEExecute. I then added AppActivate "RSView32 Works" at the end of the
Excel script to bring the focus back to the SCADA.

Not very pretty, or at all elegant, but it worked. I will still gratefully
receive any alternative suggestions.

Regards
Mark

-----Original Message-----
From: "Sage, Pete (IndSys, GEFanuc, Albany)" <[email protected]>

You can automate excel via OLE Automation from VB or VBA, that the correct
way to do it. ...<clip>



------- End of forwarded message -------

*****************************************************************
Check out the new archive of the Automation List!
It's at http://www.control.com/exchange/archive.
Before posting, please read http://www.control.com/alist/faq.txt.
The Automation List is managed by Control Technology Corporation.
 
B
An easy way to log data in an Excel compatible format is to
use VBA. Simply open a file and use the print# statement to
print your tag values to the file. Name the file *.csv, and
you will have a "comma separated value" file which Excel can
open by simply double clicking on the file.

Bill Sturm
 
Top