码迷,mamicode.com
首页 > 其他好文 > 详细

Visual Basic 2017 操作Excel和word【2】持续更新……

时间:2017-09-28 20:49:51      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:bsp   stat   清单   ima   book   status   private   object   before   

清单2.1   通过控制台应用程序自动化Excel

Imports Excel = Microsoft.Office.Interop.Excel

Module Module1

  Private exitXL As Boolean = False
  Dim WithEvents myExcelApp As Excel.Application

  Sub Main()

    myExcelApp = New Excel.Application
    myExcelApp.Visible = True
    myExcelApp.StatusBar = "Hello World"
    myExcelApp.Workbooks.Add()

    While exitXL = False
      System.Windows.Forms.Application.DoEvents()
    End While

  End Sub

  Private Sub myExcelApp_SheetBeforeDoubleClick(ByVal sheet As Object, ByVal target As Excel.Range, ByRef cancel As Boolean) Handles myExcelApp.SheetBeforeDoubleClick

    exitXL = True

  End Sub

End Module

运行结果:

技术分享

 

Visual Basic 2017 操作Excel和word【2】持续更新……

标签:bsp   stat   清单   ima   book   status   private   object   before   

原文地址:http://www.cnblogs.com/xiehaofeng/p/7608195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!