CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Posts
    3

    Problem writing Excel formulas via ODBC

    I have a C++ program writing records to an Excel spreadsheet via ODBC/SQL. The text and number values are inserted ok. I am also trying to write a formula (eg. =HYPERLINK("http://www.abc.com", "Click here for the abc site") ) into the sheet.

    The problem: the formulas are displayed as formulas - they do not calculate. If I edit the formula (changing nothing but simply pressing return to re-enter the original value) then the formula is calculated. In the example above, the hyperlink is displayed as a link.

    The same problem exists for any formula (even something as simple as =2+2).

    Does anyone know why the formulas are not calculated ? Pressing F9, Shift-F9, Crtl-Alt-F9, or calculating the worksheet with VBA don't have any effect.

    I can't believe that formulas have to be manually entered or edited before they become active. If I am missing something please let me know. Thanks in advance.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Problem writing Excel formulas via ODBC

    Make sure to use the Formula property of the worksheet object. If you are using the value property, formulas can be displayed incorrectly.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured