老头 发表于 2007-4-4 11:08:00

急!我的VB代码有什么问题!

<p>我想象CAD那样Get已打开的Excel文档,或没有打开时就建个Excel空文档.。</p><p>以下代码有什么问题或有其它方法达到这个目的吗?谢谢帮忙!</p><p>Public ExcelApp As Object ' Excel.Application<br/>'On Error Resume Next<br/>Set ExcelApp = GetObject("Microsoft Excel")<br/>If Err Then<br/>&nbsp;&nbsp;&nbsp; Err.Clear<br/>&nbsp;&nbsp;&nbsp; Set ExcelApp = CreateObject("Microsoft Excel")<br/>End If<br/>ExcelApp.Visible = True</p><p></p>

tfyyf 发表于 2007-4-4 18:36:00

On Error Resume Next<br/>Set Excel = GetObject(, "excel.Application")<br/>If Err Then<br/>&nbsp; Err.Clear<br/>&nbsp; Set Excel = CreateObject("excel.Application")<br/>&nbsp; If Err Then<br/>&nbsp; MsgBox ("不能运行excelD")<br/>&nbsp; Exit Sub<br/>&nbsp; End If<br/>&nbsp;End If<br/>&nbsp;Excel.Visible = True
页: [1]
查看完整版本: 急!我的VB代码有什么问题!