Thread: Writting a call to Excell in a DLL?

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    13

    Writting a call to Excell in a DLL?

    Right now i've got a C++ DLL i've written to do various functions in another piece of software I'm using (Tradestation). Ideally, i'd like to be able to add a function call to the DLL that will open Excel -> open a work book in a fixed location -> (and preferably) automatically run a macro.

    I know it's easy enough to order it to start Excel and open the workbook, but is it possible somehow to also get my DLL to order Excel to automatically run a macro?

  2. #2
    Registered User samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Newport
    Posts
    382
    Does Excel accept command line arguments?

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    2 ways

    Use the ShellExecute API to open the xls file. If the spreadsheet has a macro called "AutoExec", rhen that macro will run automatically

    Otherwise you need COM to create an instance of the Excel.Application object. This interface will offer methods to open workbooks, as well as to run macros

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    A preview of what you're getting into if you go the COM route using C++:
    http://cboard.cprogramming.com/showthread.php?t=30942

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error C2664 - Trying to call an external Dll
    By jamez05 in forum C++ Programming
    Replies: 3
    Last Post: 08-08-2006, 06:07 AM
  2. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  3. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  4. Call procedure in DLL
    By Mithoric in forum Windows Programming
    Replies: 4
    Last Post: 01-04-2004, 08:17 AM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM