Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

How to Avoid confirmation message in NAV ?

Posted on by 245

Hello Experts 

I am writing code for unprotecting Excel file & Saving that file using saveas function. as like below

8686.Capture_5F00_1.PNG

Variables

Name DataType Subtype Length
ExcelApplicationClass_l DotNet Microsoft.Office.Interop.Excel.ApplicationClass.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelWorkbook_l DotNet Microsoft.Office.Interop.Excel.Workbook.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelXLFileFormat_l DotNet Microsoft.Office.Interop.Excel.XlFileFormat.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelXLPlatform_l DotNet Microsoft.Office.Interop.Excel.XlPlatform.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelXLSaveAsAccessMode_l DotNet Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ExcelXLSaveConflictResoultion_l DotNet Microsoft.Office.Interop.Excel.XlSaveConflictResolution.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

While Running the above code , confirmation message is showing as like below

6038.Capture_5F00_2.PNG

But I don't want to display Confirmation message , Can any one suggest me how can I modify my code to avoid confirmation message while saving file.Because I need to run this codeunit from Job Queue.

Thank you.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: How to Avoid confirmation message in NAV ?

    On the ExcelApplication class, there is a property called DisplayAlerts set that to false

    ExcelApplicationClass_1.DisplayAlerts(FALSE);

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to Avoid confirmation message in NAV ?

    Hello,

    This confirmation message if thrown by Xlworkbook DotNet DLL

    Solution 1 would be to play arround with the saveas function parameters (specialy the  XlSaveAsAccessMode)

    Solution 2 would be to simply erase or move the destination file before the saveas execution(xlworkbook still handling the file content in memory)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans