Get Excel Range.ColumnWidth (DotNet variable)

KeeperRUKeeperRU Member Posts: 58
edited 2016-04-14 in NAV Three Tier
Hello, can't get ColumnWidth from Excel. (NAV 2016)

Have this error:
Result (decimal) := XlRange.ColumnWidth;
Microsoft Dynamics NAV
A DotNet variable has not been instantiated. Attempting to call Microsoft.Office.Interop.Excel.Range.ColumnWidth in CodeUnit Excel Management: CopyColumnWidth
OK

Also this code:
XlRange2.ColumnWidth := XlRange.ColumnWidth;

Crushed NAV at all. :dizzy:

How Can I get this ColumnWidth to operate with it as Decimal?

Best Answer

Answers

  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV Tips & Tricks' forum to 'NAV Three Tier' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • KeeperRUKeeperRU Member Posts: 58
    Does the range have 1 or multiple columns? If multiple then XlRange.ColumnWidth only works when all columns in your range have the same widths otherwise it returns NULL.

    See MSDN for details.

    Thank you, I have multiple columns with different size.
Sign In or Register to comment.