Connect with us

Excel, logging, and import

Discussion in 'Electronic Design' started by Leeper, Jul 12, 2004.

Scroll to continue with content
  1. Leeper

    Leeper Guest

    Is anyone familiar with getting Excel to automatically log data from a
    RS-232 port, importing it automatically into a spreadsheet?

    I saw it done once, and not sure how it was done, or if it was a hidden
    macro or something.
     
  2. Grzegorz G.

    Grzegorz G. Guest

    You can write script in Visual Basic or build an application (written in
    C++) and You have to use OLE. Just look at Excel & Visual Basic help.
    RS-232 port is supported by instructions:
    OpenFile(.....) - open RS port
    CloseFile(...) - close port
    ReadFile(...) - read data from port buffer
    WriteFile (...) - write data to port buffer
    Below there are few lines of code (C++) that open excel from application and
    add workbook.

    Variant XL,v0,v1,v2, v22,
    my_point,my_series,my_cell,my_workbooks, my_worksheets,
    my_range,Xrange,Trange,Urange,Irange,Qrange,cell1,cell2,
    WD,a,b,c,tt;

    XL=CreateOleObject("Excel.Application");
    XL.OlePropertySet("Visible",true);
    my_workbooks=XL.OlePropertyGet("Workbooks");
    my_workbooks.OleProcedure("Add"); // <- do tego jest OK
    v1=my_workbooks.OlePropertyGet("Item",1);
    v0=v1.OlePropertyGet("Worksheets") ;

    P.S. Sorry for my english.
    Grzegorz
     
  3. I would use the visual basic editor in in excel, ctrl-f11 or something
    like that. Not to sure if you have comm port access but a google will
    reveal all no doubt.
     
  4. Just did a quick check, Alt-f11 will get you the vb editor. Add a user
    form, then right click on the controls for the additional controls.
    Check the Microsoft communications control option. Then drag the phone
    icon onto your form. Now you have comms through excell.
     
  5. Mike Page

    Mike Page Guest

    Windisp (http://www.eclectic-web.co.uk/mike/zip/winlogic_v0-2.zip) has a
    Trend function to generate CSV files from received RS232 data, but it's
    not automatic. Well, I think it's cool anyway.

    Regards,
    Mike.
     
  6. Anand Dhuru

    Anand Dhuru Guest

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-