12-11-2018 06:07 AM
Hi,
I have written a script which writes Channel Values to an Excel File.
After writng values to Excel, the below script executes which saves the file to a different path.
If I press 'YES' the file is saved or asks to overwrite. But If I click 'NO' an Option appears on Excel to save the file.I want to remove this Dialog in Excel .
Dim RawGroup,RawChannels,myExcelApp,j,myWorksheet,myRange,Excel
Call GroupDefaultSet(28)
Set myExcelApp = CreateObject("Excel.Application")
myExcelApp.Visible = TRUE
Set myWorksheet=myExcelApp.Workbooks.Open("FilePath
Set myWorksheet = myExcelApp.Activesheet
If MsgBox("Save Excel?", vbYesNo Or vbQuestion, "Bestätigen") = vbYes Then
myWorksheet.Parent.Saved = True
' Call myExcelApp.ActiveSheet.Parent.SaveAs("FilePath")
Call myWorksheet.SaveAs("SaveFilePath")
' myExcelApp.close
myExcelApp.Quit
Else myWorksheet.Parent.Saved = False
' myWorksheet.quit
' myExcelApp.close
myExcelApp.Quit
End If
Next, I want to use conditional Formatting in Excel using DIAdem script function. Can it be done?
Have A Great Day
Himanshu Sharma
01-16-2019 04:13 AM
Hey Himanshu,
Consider adding this to your script:
ExcelApp.DisplayAlerts=false
ExcelApp.Close false
It should remove any kind of prompts and save options. It works for me quite well.
Also I think that you could do conditional formatting as well - depending on what you want to achieve. Check this link and see if it works out for you - it might give you some hints:
https://stackoverflow.com/questions/13661965/conditional-formatting-using-excel-vba-code
Sincerely yours,
Denis
01-16-2019 07:45 AM
Thanks Denis