Export to Excel: Replace Overwrite file without prompting

Discussion in 'Free Source Codes' started by farrakh hayat, Nov 7, 2022.

    
  1. farrakh hayat

    farrakh hayat Member


    Dear Experts,
    I have written a function to export a report in excel format.
    It is working successfully.
    I want "If file exist, then replace/overwrite else export." automatically by function without prompting.
    I am unable to find replace/overwrite command.
    Can any body help me.

    [Function: DNDATAEMAILDNEXPREPORT]
    Return : Logical
    Variable: SVPrintFileName : String
    091 : SET : SVExcelExportUpdateBook : No
    092 : SET : SVExcelExportWithFormatting : Yes
    093 : SET : SVExcelExportWithColour : Yes
    110 : SET : SVPrintFileName : "C:\TallyPrime\Export\DNDATAEMAIL.XLSX"
    120 : Set : If : ($$IsFileExists:##SVPrintFileName)
    122 : Return : Yes
    123 : End If
    124 : Return : Yes
    150 : Set : SVOpenFileAfterExport : Yes
    160 : EXPORT REPORT : . : TRUE
     



  2. directly you cannot do an overwrite yes/No as its controlled by kernal level
    what you can do is if file exist delete the file and then export the new file it will not prompt for the overwrite/replace
     
    naren1234 and farrakh hayat like this.


  3. farrakh hayat

    farrakh hayat Member


    111 :do if : ( $$isfileexists:##SVPrintFileName) : Delete file:##SVPrintFileName
     
    naren1234 likes this.


  4. ANURAG954245

    ANURAG954245 Member


    simply try this 160 : EXPORT REPORT : . : TRUE:TRUE
     
    naren1234 likes this.


Share This Page