Excel Automation - insert row in Excel sheet

scheduschedu Member Posts: 12
Hi,
i am trying to insert a row in an excel sheet i create out of Navision.

I found a topic about excel with a function called "Selection.EntireRow.Insert"
viewtopic.php?t=927

Now i am trying to use this function but i cannot find it in any automation variables.
I can find Selection in the Properties of the Application variable, but as soon as i add ".entirerow.insert" I get an error that entirerow is an unknown variable.

Does anyone know how to solve this or post a function i can use to insert a new row and move all following rows down (in a preformated excel workbook created out of a template).
I am using the Excel Buffer Table from NAV 4.0 SP3 and the included automation variables.

Thanks!

Best regards,

schedu

Answers

  • scheduschedu Member Posts: 12
    Is there anyone experienced with this who can help or give me a hint?
  • scheduschedu Member Posts: 12
    I found a way how to solve this although I am not sure if it is the easiest way.

    The worksheet and the cell can be "activated" and ActiveCell.Entirerow.Insert can then be used to insert a row below the activated cell.

    XlApp: 'Microsoft Excel 14.0 Object Library'.Application
    xlWrkSht: 'Microsoft Excel 14.0 Object Library'.Worksheet
    xlWrkSht.Activate;
    xlWrkSht.Range('C3').Activate;
    
    XlApp.ActiveCell.EntireRow.Insert;
    

    Replies with easier solutions are still highly appreciated :D
Sign In or Register to comment.