Hi,
I can successfully write an excel file once with a particular name:
When I rerun the code (without manually closing the created workbook) the program automatically saves to:
Checkers_Subscribers (1).xlsx .... then Checkers_Subscribers (2).xlsx ... then Checkers_Subscribers (3).xlsx etc.
If I try to delete or copy the file using file.delete or file.copy I get an error because "the file is in use by another program".
How can I close "Checkers_Subscribers.xlsx" with code so that I can delete it and rerun the program to produce an updated excel file with the same name?
Any help would be much appreciated.
I have noticed that if I don't use the line:
then the excel is still created but not shown and can be deleted and created again with the same name.
So possibly the solution would be to go down this path and make a separate data file to hold updated data (the data file can be read and updated) and just use the excel file to show the updated data when it is opened manually.
I can successfully write an excel file once with a particular name:
B4X:
'save the workbook
Dim f As String = Workbook.SaveAs(File.DirApp, "Checkers_Subscribers.xlsx", True)
Wait For (xl.OpenExcel(f)) Complete (Success As Boolean)
When I rerun the code (without manually closing the created workbook) the program automatically saves to:
Checkers_Subscribers (1).xlsx .... then Checkers_Subscribers (2).xlsx ... then Checkers_Subscribers (3).xlsx etc.
If I try to delete or copy the file using file.delete or file.copy I get an error because "the file is in use by another program".
How can I close "Checkers_Subscribers.xlsx" with code so that I can delete it and rerun the program to produce an updated excel file with the same name?
Any help would be much appreciated.
I have noticed that if I don't use the line:
B4X:
Wait For (xl.OpenExcel(f)) Complete (Success As Boolean)
then the excel is still created but not shown and can be deleted and created again with the same name.
So possibly the solution would be to go down this path and make a separate data file to hold updated data (the data file can be read and updated) and just use the excel file to show the updated data when it is opened manually.