Notifications
Announcements
No record found.
Hello Experts,
How can we do Saveas() a Excel file Directly without displaying confirmation message (by Writing Code-unit).
Thank you.
Use Outstream , sample code :
File.CREATE('C:\YourExcelFile.xls');
File.CREATEOUTSTREAM(Outstr);
YourRec.SETFRANGE("FIeld 1",Filter1);
IF YourRef.FINDFIRST THEN BEGIN
RecordRef.SETTABLE(YourRec);
REPORT.SAVEAS(REPORT::"Your Report Name",'',REPORTFORMAT::Excel,OutStr,RecordRef)
END;
https://docs.microsoft.com/en-us/dynamics-nav/createoutstream-function--file-
FIle.CLOSE
Thanks for Your Replay,
Actually I am Unprotecting the Excel file & Saving that file in same path. The code is like below.
Ideally this Message will only come when you already have a file at that location with the same name so technically this is a correct message, if want to get rid of this message then you need to first check if that file already exist there and if yes then you need to move or delete that file.
As you said , I modified code as like below(added code for Deleting existing file from local system).
But while running this code I am getting error , below.
Hello,
Try to use Save() instead of SaveAs().
Or set DisplayAlerts to False before saving the file:
ExcelApplicationClass.DisplayAlerts := FALSE; ExcelWorkbook.SaveAs(); ExcelApplicationClass.DisplayAlerts := TRUE;
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
OussamaSabbouh 2,238
YUN ZHU 773 Super User 2025 Season 2
Sumit Singh 630