我也有这个问题,运行程序后进程总是关不了
Private Sub Form_Load()
File1.Pattern = "g*.txt;z*.txt;1-printhighf-g*.txt;1-printhighf-z*.txt"
Set ex = CreateObject("Excel.Application")
Set wb = ex.workbooks.Add
Set sh = wb.Sheets(1)
End Sub谁能帮忙看看是什么回事
我想调用系统中的   dxdiag  查看系统信息,要怎么做呢?

解决方案 »

  1.   

    我也有这个问题,运行程序后进程总是关不了 
    Private Sub Form_Load() 
    File1.Pattern = "g*.txt;z*.txt;1-printhighf-g*.txt;1-printhighf-z*.txt" 
    Set ex = CreateObject("Excel.Application") 
    Set wb = ex.workbooks.Add 
    Set sh = wb.Sheets(1) 
    End Sub 谁能帮忙看看是什么回事 ==================
    因为要关闭excel呀.我并没有看见你的关闭代码 ex.Quit
     Set ex = Nothing
    这样就行了我想调用系统中的   dxdiag  查看系统信息,要怎么做呢?
    //
     Shell "dxdiag "不过个人不建议这么做,用wmi自己在程序中写也很简单的
      

  2.   

    参考: 
    --------------------------------------   
      先关闭,然后再释放,注意,每个创建的对象都必须释放,否则就会出现你所说的情况:   
        
      Public   xlApp   As   Excel.Application   
      Public   xlWorkbook   As   Excel.Workbook   
      Public   xlWorksheet   As   Excel.Worksheet   
        
      '创建一个Excel   Workbook   
              Set   xlApp   =   New   Excel.Application   
              xlApp.Workbooks.Open   Trim(Text1.Text)   
              Set   xlWorkbook   =   xlApp.Workbooks(1)   
              Set   xlWorksheet   =   xlWorkbook.Worksheets(2)   
        
      xlWordbook.Close   False   '关闭WordBook   
      xlApp.Quit   '退出Excel   
        
      '释放xlApp,xlWorkbook,xlWorksheet   对象:   
      Set   xlApp=Nothing   
      Set   xlWorkbook=Nothing   
      Set   xlWorksheet=Nothing   
      

  3.   

    我的代码是这样的
    Private Sub Command1_Click()
    Dim i As Integer, j As Integer, G As Integer
    Dim fn As Long, strT As String, arr() As String
    For i = 0 To File1.ListCount - 1
        fn = FreeFile
        Open File1.Path & "\" & File1.List(i) For Input As #fn
            For j = 1 To 3
                Line Input #fn, strT
            Next j
        arr = Split(strT, ",")
        sh.cells(1, 1) = "线路名"
        sh.cells(1, 2) = "导线长度"
        sh.cells(1, 3) = "Fb"
        sh.cells(1, 4) = "Fb(max)"
        sh.cells(1, 5) = "相对闭合差"
        sh.cells(1, 6) = "站数"
        sh.cells(i + 2, 1) = arr(7)
        sh.cells(i + 2, 2) = arr(4)
        sh.cells(i + 2, 3) = arr(0)
        sh.cells(i + 2, 4) = arr(1)
        sh.cells(i + 2, 5) = arr(6)
       G = 0
            Do Until EOF(1)
                Line Input #fn, strT
                G = G + 1
            Loop        Close #fn
       sh.cells(i + 2, 6) = G
    Next i
    ex.Visible = True
    End Sub要在那里加关闭呢加了ex.Quit 
     Set ex = Nothing 
    后一打开就问要不要关闭拉...