因为要固定excel的前2行,我加了以下的代码
.Rows("3:3").Select
ActiveWindow.FreezePanes = True(问题出在这一行)
先说明一下,在加这两行代码以前进程的excel可以关闭,加了以后,以下的代码也执行了,就是不关闭进程
xlsApp.DisplayAlerts = False
Set xlsSheet = Nothing
xlsBook.Close
Set xlsBook = Nothing
xlsApp.Quit
Set xlsApp = Nothing
大家还有什么固定行的办法吗

解决方案 »

  1.   

    朋友们都哪儿去了,出来帮下忙啊
    excel关闭了,可是进程没有关闭啊
      

  2.   

    试试这样,处理完再取消锁定,再关闭
    ActiveWindow.FreezePanes = false后面再调用
    xlsApp.DisplayAlerts = False 
    Set xlsSheet = Nothing 
    xlsBook.Close 
    Set xlsBook = Nothing 
    xlsApp.Quit 
    Set xlsApp = Nothing 
      

  3.   

    要先保存了sheet表才能关闭Excel程序。
      

  4.   

    按下列顺序执行:
    xlBook.Save
    xlBook.Close
    xlExcel.Quit
    Set xlSheet = Nothing
    Set xlBook = Nothing
    Set xlExcel = Nothing
      

  5.   

    由内到外逐层关闭,如楼上所说的一样。xlsApp.DisplayAlerts = False
    销毁应用程序对象以前应该再把这个赋True。
      

  6.   

    xlBook.Save 
    xlBook.Close 
    xlExcel.close
    Set xlSheet = Nothing 
    Set xlBook = Nothing 
    Set xlExcel = Nothing 
      

  7.   

    .Rows("3:3").Select 
    ActiveWindow.FreezePanes = True(问题出在这一行) 
    先说明一下,在加这两行代码以前进程的excel可以关闭,加了以后,就是不关闭进程大家的方法我都试过了,不管用啊
    再说明一下,我不加入固定前二行的时候,进程可以关闭继续等待中,如果分不够,我在加
      

  8.   

    .Rows("3:3").Select 
    如果是在VBA里面,这个是全局的,在VB里不是全局对象,可能会导致错误,在前面加上父级对象。Object.rows
      

  9.   

    ActiveWindow.FreezePanes = True确实是这一句有问题.
    ActiveWindow.FreezePanes = True改成:
    xlsApp.ActiveWindow.FreezePanes = True