Foxtable(狐表)用户栏目专家坐堂 → [BUG]FileCreated 代码为何不执行?


  共有4014人关注过本帖平板打印复制链接

主题:[BUG]FileCreated 代码为何不执行?

帅哥哟,离线,有人找我吗?
don
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12993 威望:0 精华:14 注册:2008/10/11 18:07:00
[BUG]FileCreated 代码为何不执行?  发帖心情 Post By:2014/7/8 14:17:00 [只看该作者]

'AfterOpenProject代码

With FileWatcher
    .Path = "D:\Met\Reports"
    .Filter = "*.xls"
    .Delay = 1000
    .Enabled = True
End With


'FileCreated  创建文件,  

'以下代码在文件文件监视器FileCreated中没有达到预期效果
'如把 e.FullPath 换成 flur  放在命令窗口中是可以的!

Dim flur,pasw String
flur = "D:\Met\Reports\9.PPS Record 07 Jul 2014.xls"
pasW = "12345678"
    
If e.FullPath.ToUpper.Contains("PPS") AndAlso e.FullPath.ToUpper.Contains(".XLS") Then        
        Ap01 = New MSExcel.Application
        Wb01= Ap01.WorkBooks.Open(e.FullPath,,True,,pasw) 
        Ws01= Wb01.WorkSheets("Data")
        Ws01.AutoFilterMode = False
        If  Ws01.cells(1,1).Value  =Nothing  Then 
            Ws01.Rows(1).Delete(MSExcel.XlDirection.xlUp)  '下面的单元格上移
        End If
        If  Ws01.cells(2,9).Value  =Nothing  Then Ws01.cells(2,9).Value  = 0
        If  Ws01.cells(2,10).Value  =Nothing  Then Ws01.cells(2,10).Value  = 0
        If  Ws01.cells(2,12).Value  =Nothing  Then Ws01.cells(2,12).Value  = 0

        wb01.saveAs("D:\Met\PPS.xls")   '没有执行
        Ap01.Quit
        
        FileSys.DeleteFile(e.FullPath,2,2)  '没有执行
End If
[此贴子已经被作者于2014-7-8 15:57:43编辑过]

 回到顶部
总数 22 1 2 3 下一页