Recently, I have switched to my system Window Vista back to Window XP.
And re-run my VBA program in Window XP Excel 2003, there is a lot of problem which is never happen before in Window Vista running 2003 Excel. Now A lot problem is solved besides workbooks.open command
in vba, I need to loop and open 100 files and write data and then save and close file
and open next file
until 100 files is done,
During file open loop, the error is came out randomly during file opening (I mean not at an specified file name). I want to
know there is any syntax error on my coding. The error is always at "excel.Application.workboo
the Excel ask me do I need to report to the bug to microsoft ? and then try to do recovery on the file expected to be
opened with fail. But I found no any file is damaged by VBA program when open it in other standalone Excel program
I try to put delay after complete file ready checking function and before Open command but it is still in problem
and also put Application.EnableEvents = False before Workbooks.open comand, it is also fail,
and finally I try clear up the clipboard before any file open that also fail.
The error is not stable but always report at the same workbooks.open location, it happens sometimes after 10 file is opened, sometimes, 30 file is opened, and sometimes,sometimes it will happen when third opening
Any Excel 2007 system I need to do before I pass the error. Why the performance is big difference in workbooks.open
between Windows Vista and XP's 2003 Excel VBA ?
Dim wkdir as string, openworkbookname as string
Do until k=100
If CheckFileAvailable(wkdir & openworkbookname) = "Fileinfree" Then
'Application.EnableEvents = False
Excel.Application.Workbooks.Open filename:=wkdir & openworkbookname, ReadOnly:=False
Doevent or ...
'Application.EnableEvents = True
On Error Resume Next
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFile = oFS.OpenTextFile(sFilePath, 8, False)
If Err.Number <> 0 Then
CheckFileAvailable = "Fileinuse"
' Debug.Print "FileinUse"
CheckFileAvailable = "Fileisfree"
Public Function ClearClipboard()