|
-
Mar 16th, 2009, 12:45 PM
#1
Thread Starter
Addicted Member
Re: Possible intermittent problem ?
Fatal Error writing data files !
Error Description = Method ' ~ ' of Object ' ~ ' failed.
Error Number = -2147023446
The subroutine is trying to write two files, one with a simple string name, the other with the Date/Time string name.
Here is the source:
Public Sub AutoWriteDispData()
Dim fso, txtfile
Dim ThisTime As Variant
Dim strThisTime As String
On Error GoTo FileError:
Set fso = CreateObject("Scripting.FilesystemObject")
' write file with time date stamp unique name
strThisTime = Format(Now, "mm_dd_yyyy_____Hh_mm_ss")
Set txtfile = fso.CreateTextFile("C:\CES\XRF_Control\Data_Files\" & strThisTime & ".txt", True)
txtfile.WriteLine (gblstrAcquisitionFileData)
txtfile.Close
Set fso = Nothing ' Free up resources
Set fso = CreateObject("Scripting.FilesystemObject")
' write file with time date stamp unique name
strThisTime = "SPC_Data"
Set txtfile = fso.CreateTextFile("C:\SPCData\" & strThisTime & ".txt", True)
txtfile.WriteLine (gblstrAcquisitionFileData)
txtfile.Close
Set fso = Nothing ' Free up resources
Exit Sub
FileError:
MsgBox " FATAL ERROR WRITING DATA FILES ! " & " Error Description = " & Err.Description & " Error Number = " & _
Err.Number
Err.Clear
End Sub
-
Mar 16th, 2009, 12:46 PM
#2
Thread Starter
Addicted Member
Re: Possible intermittent problem ?
Also, I should mention this same subroutine is exactly the same in two other units running just fine on two other machines. One machine has been writing these files for months with no problems....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|