+ Reply to Thread
Results 1 to 4 of 4

Serial I/O using kernel32

  1. #1
    Registered User
    Join Date
    10-31-2011
    Location
    Near London, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Serial I/O using kernel32

    I am trying to get the following (well-known) code working under Excel 2003 and Windows XP:

    http://dev.emcelettronica.com/serial...tion-excel-vba

    This code is followed by:
    Please Login or Register  to view this content.

    Using a serial line analyzer, I see that nothing happens when pressing CommandButton1. The COM port does not open.

    Before I jump in to debug this in detail, a couple of questions:

    1. Has anyone here got this code working successfully?

    2. Do I have to declare kernel32 somewhere else before this code will work?

    (Before anyone asks, I am talking specifically about kernel32. I need to use this for program portability, without the need for the user to install anything else to make it work).

    --
    Ian
    Last edited by IanWade; 10-31-2011 at 06:36 PM. Reason: Put code between CODE tags

  2. #2
    Registered User
    Join Date
    11-08-2011
    Location
    SA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Serial I/O using kernel32

    Please Login or Register  to view this content.
    Hi IanWade

    I'm using the code you asked about as is with the above mod to the last part of the code to read data from an scale instrument into sheet 1.
    The code works fine but need some tweaking to use less resources.
    I'm still a noob with VBA but maybe this will help.
    Please let me know if you can get it to use less cpu power when reading from the com port.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Serial I/O using kernel32

    Hello IanWade,

    Welcome to the Forum!

    Kernel32 is the heart of the Windows OS. It is actually a large DLL (Dynamic Link Library) which contains many API (Applications Programming Interface) calls. The Comm calls are but a small number of them.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    10-31-2011
    Location
    Near London, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Serial I/O using kernel32

    [QUOTE=IanWade;2631949]I am trying to get the following (well-known) code working under Excel 2003 and Windows XP:

    (snip)

    Before I jump in to debug this in detail, a couple of questions:

    1. Has anyone here got this code working successfully?

    2. Do I have to declare kernel32 somewhere else before this code will work?
    /QUOTE]

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    To answer my own questions:

    1. Yes, I have now managed to make it work. For reasons that are still opaque to me, the code only works for COM1 thru COM4. I need to investigate further, but as it is more to do with Windows library parameters rather than Excel, I will look elsewhere for a solution.

    2. No, it is not necessary to make references to kernel32, other than those that exist in the code already.

    --
    Ian

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1