vb如下代码 帮我看看哪的毛病D
我觉得你的声明不该全用object
引用以后,可以这样声明
Private xlApp As Excel。Application
Private xlWorkbook As Excel。 Workbook
Private xlWorksheet As Excel。Worksheet
'创建一个Excel Workbook
Set xlApp = New Excel。 Application
xlApp。Workbooks。Open Trim(Text1。Text)
Set xlWorkbook = xlApp。Workbooks(1)
Set xlWorksheet = xlWorkb...全部
我觉得你的声明不该全用object
引用以后,可以这样声明
Private xlApp As Excel。Application
Private xlWorkbook As Excel。
Workbook
Private 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)
xlApp。Quit '退出Excel
'释放xlApp,xlWorkbook,xlWorksheet 对象:
Set xlApp=Nothing
Set xlWorkbook=Nothing
Set xlWorksheet=Nothing
你试试你的代码中添加以下:
。
。。。。。
CommonDialog1。Action = 2
exwbook。SaveAs CommonDialog1。FileName & Date
…………
ex。Quit
Set ex=Nothing'添加此段
Set exsheet = Nothing
Set exwbook = Nothing
试试看,能否关闭:)。
收起