I am calling UE from Excel using Visual Basic. The UE script does a bunch of file manipulations and at the end has an UltraEdit.saveAs command that works successfully.
But when I go to close the file that I saved I get the following error: IPEX_SearchReplace.js contains an invalid path.
Here is the code that creates the file name and path to execute the saveAs and close the file:
But if I run the script from UltraEdit I don't get the error. Why does it work one way, but not the other?
What am I doing wrong?
Thank you.
But when I go to close the file that I saved I get the following error: IPEX_SearchReplace.js contains an invalid path.
Here is the code that creates the file name and path to execute the saveAs and close the file:
Code: Select all
var now = new Date();
var month = now.getMonth();
month = month + 1;
if (month < 10) {
month = "0" + month;
}
var day = now.getDate();
if (day < 10) {
day = "0" + day;
}
var hours = now.getHours();
if (hours < 10) {
hours = "0" + hours;
}
var minutes = now.getMinutes();
if (minutes < 10) {
minutes = "0" + minutes;
}
var seconds = now.getSeconds();
if (seconds < 10) {
seconds = "0" + seconds;
}
var sPath="H:\\IPEX\\DataFiles\\IPEX_Originals_Cleaned_Files\\"
+ sTransSet
+"_"
+ sDocNum
+ "_"
+ now.getFullYear()
+ month
+ day
+ "-"
+ hours
+ minutes
+ seconds
+ ".txt";
UltraEdit.saveAs(sPath);
// Free memory and switch back to Windows clipboard.
UltraEdit.clearClipboard();
UltraEdit.selectClipboard(0);
// This is the line that errors out when executing from excel, but does not error out when script is run directly from UE
UltraEdit.closeFile(sPath,2);
What am I doing wrong?
Thank you.