Do i need a close at the end of this code???
-
Hi, I just want to know if it would be advised to put the following at the end of this code:
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objOutFile = objFSO.OpenTextFile("\\jhbtest01\e$\SARS\Script\FileWithFilePath\FileNameFormA.txt", 2, True) strLine = FileName objOutFile.WriteLine strLine
Should i add this at the end:objOutFile.Close
AND is this the right way of doing the close section??? (it is working without it but i get error... so it works the first time round but fails second time round... without me seeing the error.)... Oh yeah... this bit of code is in a javascript file that i call through VB.Net using theShell()
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi, I just want to know if it would be advised to put the following at the end of this code:
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objOutFile = objFSO.OpenTextFile("\\jhbtest01\e$\SARS\Script\FileWithFilePath\FileNameFormA.txt", 2, True) strLine = FileName objOutFile.WriteLine strLine
Should i add this at the end:objOutFile.Close
AND is this the right way of doing the close section??? (it is working without it but i get error... so it works the first time round but fails second time round... without me seeing the error.)... Oh yeah... this bit of code is in a javascript file that i call through VB.Net using theShell()
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
Support123 wrote:
Should i add this at the end: objOutFile.Close
Yeah, that would probably be a good idea.
Support123 wrote:
it is working without it but i get error...
And that error would be ....??
Support123 wrote:
so it works the first time round but fails second time round...
This is probably because you didn't close the file and are trying to open it again.
Support123 wrote:
this bit of code is in a javascript file
No, it's not. This is code snippet you posted is VBScript.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Support123 wrote:
Should i add this at the end: objOutFile.Close
Yeah, that would probably be a good idea.
Support123 wrote:
it is working without it but i get error...
And that error would be ....??
Support123 wrote:
so it works the first time round but fails second time round...
This is probably because you didn't close the file and are trying to open it again.
Support123 wrote:
this bit of code is in a javascript file
No, it's not. This is code snippet you posted is VBScript.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Support123 wrote: this bit of code is in a javascript file No, it's not. This is code snippet you posted is VBScript. sorry about that... i was thinking one thing and writing another. I had a java question too (i am working on a ssis project and asp.net project so i messed up the question). i appologize and thank you for the info. I will add the objOutFile.Close() section to the VBSript. (i dont know what the error is exactly... it is not displaying anything of use... it is saying that i have issues in one of my script files (vb.net) in the ssis package but it is working fine through visual studio... Only a problem when it is ran through a job in sql, so i thought that maybe the VBScript needed to be tweeked a bit.) I will test to see if it works. Thank you for your time.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison