vijay_s
08-17-2013, 10:47 AM
Hi folks
i'm newbie to VBA.. I'm experiencing some problem with text file write from VBA .. my code works fine until i close the file. when i reopen it, write to text file is not working, but other piece of codes are working
Below is my code
Dim FSO As FileSystemObject
Dim oFile As TextStream
'File Open
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFile = FSO.CreateTextFile("IPC_Testplan.capl", True)
oFile.WriteLine "void f_testcase_" + Worksheets("TestPlan").Cells(2, 4)
oFile.WriteLine "{"
oFile.WriteLine "}"
oFile.Close
MsgBox "generation complete"
File 'IPC_Testplan.capl' is created when i run this for first time. After i close the excel, reopen and run this(deleted already created file), no file is generated. but message box is popped up every time i run this.:help
i'm newbie to VBA.. I'm experiencing some problem with text file write from VBA .. my code works fine until i close the file. when i reopen it, write to text file is not working, but other piece of codes are working
Below is my code
Dim FSO As FileSystemObject
Dim oFile As TextStream
'File Open
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFile = FSO.CreateTextFile("IPC_Testplan.capl", True)
oFile.WriteLine "void f_testcase_" + Worksheets("TestPlan").Cells(2, 4)
oFile.WriteLine "{"
oFile.WriteLine "}"
oFile.Close
MsgBox "generation complete"
File 'IPC_Testplan.capl' is created when i run this for first time. After i close the excel, reopen and run this(deleted already created file), no file is generated. but message box is popped up every time i run this.:help