- On line 8, you declare a variable called strFile. This will generate an error as one of the parameters for the sub is called strFile. You cannot declare a variable that already exists.
- strNewFileName = strFile & "Mod" : This probably will 'work', but if the source file is "Invoice1.dat", you'll get "Invoice1.datMod". I think you're probably wanting something like "Invoice1Mod.dat" You can use Instr or Split to find the file extension. If you like your FDM method calls, you could even use fparsestring as it is just a wrapper for split most likely...
- fso : This is NEVER defined; therefore, you will have issues with lines 10 & 13. (i.e. Set fso = CreateObject("Scripting.FileSystemObject") )
- f2.writeline strSource & "," & strTarget : What happens if the source or target values has a comma in it? I would wrap both the Source and Target in quotes so that it doesn't break your file.
After implementing the script, a new file with xxxmod.trn has been generated which is as desired. But instead of using the new file,original file which has 5 cols is being used in creation of map.Can you advise me how can we change BefImportScript so that it picks the new file while creating map and not the original one.