Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use Excel macros with parameters in Qt?
Qt 6.11 is out! See what's new in the release blog

How to use Excel macros with parameters in Qt?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tania87
    wrote on last edited by
    #1

    Hello boys and girls,

    I am traying to find out, how I can start a Excel macro with Qt and use parameters.

    At first I wrote a VBScript to open a Excel document and start this macro without parameters. Now I want a nice Qt application.

    Can someone tell me, how I can do some stuff with Qt:

    • update the sheets
    • save the Excel document
    • run a Excel macro with parameters
    • close Excle

    Here is my first try
    @
    QAxObject *excel = new QAxObject("Excel.Application", this);
    QAxObject *workbooks = excel->querySubObject("Workbooks");
    workbooks->dynamicCall("Open (const QString&)", m_excelFile);
    excel->dynamicCall("DisplayAlerts(Boolean)", true);
    //workbooks->dynamicCall("RefreshAll");
    excel->dynamicCall("Save");
    excel->dynamicCall("Run (const QString&)", "Screenshot");
    workbooks->dynamicCall("Close", true);
    excel->dynamicCall("Quit", 0);
    excel->destroyed();
    @

    PS: Thank you for your time and help. I am from Germany and that is the reason form my great english skills :)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved