Industry Automation and Control Forum
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-18 03:35 AM
Hi Everyone
I am looking for a Cicode code that sets an Excel file name to current date (month-day-year)
can anyone help ?
Osama
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-19 09:11 AM
I have created two cicode functions in the attached text file, simply copy into the cicode editor
Call the function SetFileNameToDate(""C:\Temp\DataLog.xlsx"") with the file that needs changing as the argument.
In the example above the file will be renamed to something like this C:\Temp\01-19-2022.xlsx.
I have not implemented any form of error checking, Eg if the file 01-19-2022.xlsx already exists etc..
Regards
Rob
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-19 09:11 AM
I have created two cicode functions in the attached text file, simply copy into the cicode editor
Call the function SetFileNameToDate(""C:\Temp\DataLog.xlsx"") with the file that needs changing as the argument.
In the example above the file will be renamed to something like this C:\Temp\01-19-2022.xlsx.
I have not implemented any form of error checking, Eg if the file 01-19-2022.xlsx already exists etc..
Regards
Rob
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-22 09:39 AM
HI Rob
thank you for your reply
I need to have more details about how to call the function
with correct syntax
Regards
Osama
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-24 01:32 AM
You simply call the function and pass the Excel file name and path that you want to change Eg
SetFileNameToDate("C:\Temp\DataLog.xlsx")
The Excel File will be renamed to mm-dd-yyyy.xlsx . If you want to call the function by a button on a screen just copy the above into Up Command and change the path and file name to match.
Regards
Rob
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.