web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Updating existing Excel Sheet

(0) ShareShare
ReportReport
Posted on by 82

Using NAV 2016 . I have created a processing report that pulls and calculate data based on Date filter from multiple tables and companies in NAV. The report sends the results to Excel using the Excel Buffer table. The user will build charts in the Worksheet created then he or she will periodically run the processing report to update the existing data in that Worksheet without having to recreate the charts every time. I need a way to Clear the data in the worksheet before sending the updating data. I see a code in the Excel Buffer table:

 

XlWrkSht.Range('A3:P40').ClearContents;

I'm not sure how to use the DotNet variables like XlWrkBk  and XlWrkSht inorder to use the above  line of code .   

Can you please help?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    I Gusti Made Ari Profile Picture
    3,600 on at

    Please check below link for solution with same case :

    community.dynamics.com/.../153134

  • Suggested answer
    Ebitas Profile Picture
    82 on at

    Thank yo for your help. The link you suggested helped me a lot. I used the following code and it worked I had to add the CLEARALL at the end

    XlApp := XlApp.ApplicationClass;

    XlWrkBk := XlHelper.CallOpen(XlApp,FileName);

    XlWrkSht := XlWrkBk.Worksheets.Item('Tech');

    xlRange := XlWrkSht.Range('A3','P40');

    xlRange.Activate;

    xlRange.Select;

    xlRange.ClearContents;

    XlWrkBk.Save;

    XlWrkBk.Close(TRUE,FileName,TRUE);

    XlHelper.CallQuit(XlApp);

    XlApp.Quit;

    CLEARALL;

    CLEAR(XlHelper);

    CLEAR(XlApp);

    CLEAR(XlWrkBk);

    CLEAR(XlWrkSht);

    CLEAR(xlRange);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans