+ Reply to Thread
Results 1 to 4 of 4

calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet

  1. #1
    ellis kurland
    Guest

    calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet

    I have an excel spreadsheet and call a C++ program from a VBA macro using
    the command below. (I am not using visual C++ but a command line driven
    version, Borland C++ compiler)

    retval = Shell ("c:\options\options1.exe", vbNormalFocus)


    What I want to be able to do is to pass some of the values in my excel
    spreadhseet to the C++ program when calling it. There are 5
    variables(spreadsheet cells) whose numerical values I want to pass across to
    the program.

    Once the C++ program has run I want to put a value that it caluculates in to
    a cell in my excel spreadsheet.

    Any help much appreciated please.

    Many thanks



  2. #2
    Jim Rech
    Guest

    Re: calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet

    The Shell function does not provide for passing parameters to the called
    program (see Help). I suppose you could write out your variables to a file
    or to the registry. Similarly on return.

    --
    Jim
    "ellis kurland" <[email protected]> wrote in message
    news:%[email protected]...
    |I have an excel spreadsheet and call a C++ program from a VBA macro using
    | the command below. (I am not using visual C++ but a command line driven
    | version, Borland C++ compiler)
    |
    | retval = Shell ("c:\options\options1.exe", vbNormalFocus)
    |
    |
    | What I want to be able to do is to pass some of the values in my excel
    | spreadhseet to the C++ program when calling it. There are 5
    | variables(spreadsheet cells) whose numerical values I want to pass across
    to
    | the program.
    |
    | Once the C++ program has run I want to put a value that it caluculates in
    to
    | a cell in my excel spreadsheet.
    |
    | Any help much appreciated please.
    |
    | Many thanks
    |
    |



  3. #3
    actcomp
    Guest

    Re: calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet

    Thanks Jim.

    Using files would do it. Using registry sounds a bit neater but I do
    not know how to use write values from c++ program to the registry and
    how the excel spreadsheet would then pick up these values. Similarly do
    not know how to write values from the spreadsheet to the registry and
    how the c++ program would "read" them.

    Any further thoughts please?

    Thanks

    Jim Rech wrote:
    > The Shell function does not provide for passing parameters to the called
    > program (see Help). I suppose you could write out your variables to a file
    > or to the registry. Similarly on return.
    >
    > --
    > Jim
    > "ellis kurland" <[email protected]> wrote in message
    > news:%[email protected]...
    > |I have an excel spreadsheet and call a C++ program from a VBA macro using
    > | the command below. (I am not using visual C++ but a command line driven
    > | version, Borland C++ compiler)
    > |
    > | retval = Shell ("c:\options\options1.exe", vbNormalFocus)
    > |
    > |
    > | What I want to be able to do is to pass some of the values in my excel
    > | spreadhseet to the C++ program when calling it. There are 5
    > | variables(spreadsheet cells) whose numerical values I want to pass across
    > to
    > | the program.
    > |
    > | Once the C++ program has run I want to put a value that it caluculates in
    > to
    > | a cell in my excel spreadsheet.
    > |
    > | Any help much appreciated please.
    > |
    > | Many thanks
    > |
    > |



  4. #4
    Jim Rech
    Guest

    Re: calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet

    Writing to the registry from Excel and reading the registry from Excel can
    be done in several ways. Using the GetSetting and SaveSetting functions
    that are built into VBA (see Help) are the simplest. They used a fixed
    location (HKEY_CURRENT_USER\Software\VB and VBA Program Settings) but that's
    okay.

    I don't program in C++ but surely you can do a web search to find examples
    of accessing the registry with it<g>.

    --
    Jim
    "actcomp" <[email protected]> wrote in message
    news:[email protected]...
    | Thanks Jim.
    |
    | Using files would do it. Using registry sounds a bit neater but I do
    | not know how to use write values from c++ program to the registry and
    | how the excel spreadsheet would then pick up these values. Similarly do
    | not know how to write values from the spreadsheet to the registry and
    | how the c++ program would "read" them.
    |
    | Any further thoughts please?
    |
    | Thanks
    |
    | Jim Rech wrote:
    | > The Shell function does not provide for passing parameters to the called
    | > program (see Help). I suppose you could write out your variables to a
    file
    | > or to the registry. Similarly on return.
    | >
    | > --
    | > Jim
    | > "ellis kurland" <[email protected]> wrote in message
    | > news:%[email protected]...
    | > |I have an excel spreadsheet and call a C++ program from a VBA macro
    using
    | > | the command below. (I am not using visual C++ but a command line
    driven
    | > | version, Borland C++ compiler)
    | > |
    | > | retval = Shell ("c:\options\options1.exe", vbNormalFocus)
    | > |
    | > |
    | > | What I want to be able to do is to pass some of the values in my excel
    | > | spreadhseet to the C++ program when calling it. There are 5
    | > | variables(spreadsheet cells) whose numerical values I want to pass
    across
    | > to
    | > | the program.
    | > |
    | > | Once the C++ program has run I want to put a value that it caluculates
    in
    | > to
    | > | a cell in my excel spreadsheet.
    | > |
    | > | Any help much appreciated please.
    | > |
    | > | Many thanks
    | > |
    | > |
    |



+ 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