调用加载项后VB6不关闭Excel.exe [英] VB6 Not Closing Excel.exe after calling an add-in
问题描述
Sub test()
Dim oapp1 As Excel.Application
Dim oWBa1 As Excel.Workbook
设置oapp1 = CreateObject(" excel.Application")
设置oWBa1 = oapp1.Workbooks.Open(" c:\ _ReportENG1 \sourcefile.xlsx")
Dim oWS1 As Excel.Worksheet
Dim ai作为Excel.AddIn
设置ai = oapp1.AddIns.Add(" C:\Program Files(x86)\ PIPC \Excel \ pipc32.xll",真)
ai.Installed = True
设置oWS1 = oWBa1.Worksheets(" report")
计算
oWBa1.SaveAs(" c:\ _ReportENG1 \ test .xlsx")
oWBa1.Save
oWBa1.Close
oapp1.Quit
Set oWS1 = Nothing
Set oWBa1 = Nothing
Set oapp1 = Nothing
结束子
该程序只是每天发送报告,然后打开excel文件然后调用加载项,这是与数据服务器的连接,然后使用pdf副本重新计算并保存报告,然后附加它发送电子邮件并发送它。面临
的问题是程序在excel关闭后没有关闭EXCEL.exe并导致加载项停止运行,因此从报告中的那一点开始显示#name?所有字段中的错误...
有人可以在这方面帮助我吗?
behnam
您好,
您可以查看此帖子以了解在哪里询问关于VB6的问题。这个论坛适用于VB.NET。
:)
块引用>
Sub test() Dim oapp1 As Excel.Application Dim oWBa1 As Excel.Workbook Set oapp1 = CreateObject("excel.Application") Set oWBa1 = oapp1.Workbooks.Open("c:\ReportENG1\sourcefile.xlsx") Dim oWS1 As Excel.Worksheet Dim ai As Excel.AddIn Set ai = oapp1.AddIns.Add("C:\Program Files (x86)\PIPC\Excel\pipc32.xll", True) ai.Installed = True Set oWS1 = oWBa1.Worksheets("report") Calculate oWBa1.SaveAs ("c:\ReportENG1\test.xlsx") oWBa1.Save oWBa1.Close oapp1.Quit Set oWS1 = Nothing Set oWBa1 = Nothing Set oapp1 = Nothing End SubThe program simply is sending reports on daily basis, it opens excel file then calls the add-in, which is the connection to a data server, then recalculates and saves the report with a pdf copy, then attaches it to email and send it. The problem im facing is that the program doesnt close EXCEL.exe after the excel closes and that causes the add-in to stop functioning and so from that point on the report shows #name? error in all the fields...
can anyone help me in this regard?
behnam
解决方案Hi,
You can look at this thread to see where to ask questions about VB6. This forum is for VB.NET. :)
这篇关于调用加载项后VB6不关闭Excel.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!