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 shall I use VB function parameters in Qt call?
Forum Updated to NodeBB v4.3 + New Features

How shall I use VB function parameters in Qt call?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 713 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.
  • F Offline
    F Offline
    flammmable
    wrote on last edited by
    #1

    This VB function returnes address in A1-format.

    mc.Address()
    

    If I whant R1C1-format I shall to set "ReferenceStyle" to "xlR1C1".
    Like this

    mc.Address(true, true, xlR1C1)
    

    or this

    mc.Address(ReferenceStyle:=xlR1C1)
    

    In Qt this code is working:

    cell->dynamicCall("Address(true, true, xlR1C1)").toString();
    

    But this code is not (format address still "A1"):

    cell->dynamicCall("Address(ReferenceStyle:=xlR1C1)").toString();
    

    How shall I use VB function parameters in Qt call?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, I don't think Qt supports VB named parameters (i.e. using "paramname := value") in the ->dynamicCall function, so you have to specify all the arguments :-(
      Instead of true you can say -1 (it's the same in VB/COM), so this also works:

      cell->dynamicCall("Address(-1,-1,xlR1C1)").toString();
      
      1 Reply Last reply
      4
      • F Offline
        F Offline
        flammmable
        wrote on last edited by
        #3

        Unbelievable...

        JonBJ 1 Reply Last reply
        0
        • F flammmable

          Unbelievable...

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @flammmable
          What's unbelievable? That Qt --- a platform independent library/toolkit --- does not support named parameters when allowing you to use VBA to communicate with MS Excel...?

          1 Reply Last reply
          2
          • F Offline
            F Offline
            flammmable
            wrote on last edited by
            #5

            OP reporting the results of the invistigation )

            Actualy, I need to use Range.Find with whole match.
            In VB it will be like this

            cell = someRange.Find("something", LookAt:=xlWhole)
            

            In Qt it will be like this

            QAxObject* MainWindow::findCell(QAxObject* range, QString what) {
                QAxObject* firstCell;
            
                firstCell = range->querySubObject("Cells(1,1)");
                return range->querySubObject("Find(const QString&, " + 
                                                  "const QVariant&," +
                                                  "int, "            +
                                                  "int)", 
                                             what, 
                                             firstCell->asVariant(), 
                                             -4163, 
                                             1);
            }
            
            ...
            
                cell = findCell(someRange, "something");
            

            By the way.
            Result: first part match

            range->querySubObject("Find(const QString&, const QVariant&)", what, firstCell->asVariant());
            

            Result: still first part match

            range->querySubObject("Find(const QString&, const QVariant&,  xlValues, xlWhole)", what, firstCell->asVariant());
            

            Result: still first part match

            range->querySubObject("Find(const QString&, const QVariant&, -4163, 1)", what, firstCell->asVariant());
            

            Result: NULL

            range->querySubObject("Find(const QString&, const QVariant&, const QString&, const QString&)", what, firstCell->asVariant(), "xlValues", "xlWhole"))
            

            Result: NULL

            range->querySubObject("Find(const QString&, const QVariant&, int, int)", what, firstCell->asVariant(), -1, 1);
            
            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