Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim ExcelIsRunning As Boolean
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then ExcelIsRunning = False
If ExcelIsRunning = False Then
   Set xlApp = CreateObject("Excel.Application")
   xlApp.Visible = True
   Set xlBook = xlApp.Workbooks.Add
   Set xlsheet = xlBook.Worksheets(1)
  
   xlsheet.Name = "xsw"
  With xlsheet
  
   .Range("a1").value = "hello baby!"
   .Range("a2").value = "重新建立"
  
   End With
Else
   
      xlApp.Visible = True
   Set xlBook = xlApp.Workbooks.Add
   Set xlsheet = xlBook.Worksheets(1)
    xlsheet.Name = "xsw1"
  With xlsheet
    .Range("a1").value = "hello baby!"
    .Range("a2").value = "直接引用"
   
   End With
End If
TAG: 测量
发表评论
【声明】 路桥吾爱刊载的资讯及其他内容均由网友提供分享 并且纯属作者个人观点,不表示路桥吾爱同意其说法或描述,仅为提供更多信息,也不构成任何建议。网友转载请注明原作者姓名及出处。如有侵犯到您的版权,请与我们联系,我们会马上进行重新整理!