Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Replace Excel using ilogic code

karram
Advocate

Replace Excel using ilogic code

karram
Advocate
Advocate

How can i replace Excel file with "yes" as shown below image using ilogc code.

 

karram_0-1654930053795.png

 

0 Likes
Reply
Accepted solutions (1)
333 Views
5 Replies
Replies (5)

A.Acheson
Mentor
Mentor

Can you please provide the ilogic code your are using to generate the excel message dialog? Are you overwriting an excel file? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes

karram
Advocate
Advocate

Herewith attached code below.

'Save Excel files as current folder patch
oPath = ThisDoc.Path
oFolder = oPath
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
End If

myXLS_File = oFolder & "\" & xlDocID & ".xls"
xlWB.SaveAs(myXLS_File) = True
GoExcel.DisplayAlerts = True
myXLS_File.close
0 Likes

A.Acheson
Mentor
Mentor

Can you post more of the code your using and explain the design intent of what your looking to achieve. Are you exporting a BOM or saving a new excel workbook?  Go Excel has no Save as method so you might need to switch to Excel Application to to do the work. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes

karram
Advocate
Advocate

Yes! i am export BOM with specific folder. But while Exporting again and again with same file name using automatically replace with YES using ilogic code

0 Likes

A.Acheson
Mentor
Mentor
Accepted solution

You can first check if the file exist then just delete the file before exporting the New BOM. This will eliminate the need to overwrite the file and prevent the dialog.  Although in my testing the standard BOM export will automatically overwrite the file without the warning dialog. I suspect that the larger rule you are using has other issues with the workflow. Please share the entire rule if this is still an issue. 

'Check if file exists, if it does then delete 
If System.IO.File.Exists(myXLS_File) Then
	System.IO.File.Delete(myXLS_File)
End If

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes