XlRange Automation replacement in 2016

rathin_mcarathin_mca Member Posts: 14
Hi Experts,

Need a help

2009 XlRange automation used with below code

//"Cell Value as Text" := DELCHR(FORMAT(XlWrkSht.Range(xlColID + xlRowID).Value),'<',' ');
XlRange := XlWrkSht.Range(xlColID + xlRowID);
"Cell Value as Text" := DELCHR(FORMAT(XlRange.Value),'<',' ');
Formula := '';
IF (FORMAT(XlRange.HasFormula)) = FORMAT(TRUE) THEN
Formula := FORMAT(XlRange.Formula);
Bold := FORMAT(XlRange.Font.Bold) = FORMAT(TRUE);
IF (FORMAT(XlRange.Font.Italic) = FORMAT(TRUE)) THEN
Italic := TRUE;
Underline := FORMAT(XlRange.Font.Underline) = FORMAT(TRUE);
//NumberFormat := FORMAT(XlRange.NumberFormat);
xlPosID := xlColID+xlRowID;

I have replaced using dot net but am getting error

Created DotNet var for XLRange and used this variable where ever exist

Microsoft.Office.Interop.Excel.Range.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

but am getting the err when i import the excel

A DotNet variable has not been instantiated. Attempting to call Microsoft.Office.Interop.Excel.Worksheet.Range in Table Excel Buffer: ReadSheet

Answers

  • Peter+is1Peter+is1 Member Posts: 174
    I could be [XlWrkSht.Range(xlColID + xlRowID);] is not returning a (valid) range so the XlRange is not created.
    \\
    The truth exists in seven versions.
  • Hi Rathin,
    if You are using Same Code Implementation in Dotnet Can I know the Nav Version you Are using right Now ..
    there are Many Differences in Code Syntax To Dotnet When Compared to Automation Variables. Like
    XlRange := XlWrkSht.Range(xlColID + xlRowID);


    Xlrange := Xlwrksht.Range('A'+i,'B'+i);

    Let Me Know If Above Is Not the problem ...
  • rathin_mcarathin_mca Member Posts: 14
    Hi Venkat,
    I am trying to implement to 2016
  • Hi Rathin,
    I Have Implemented it In 2016 For our Cliet As Dotnet Will Be Fast Compared to Automation Variables .
    What Should i Post To Help Your Cause. i Have Done Many Reports using Those Variables
Sign In or Register to comment.