Dzwebs.Net

撰写电脑技术杂文十余年

使用CreateObject创建Excel实例代码

Admin | 2011-10-5 9:04:20 | 被阅次数 | 7641

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  一、使用CreateObject创建Excel

  Sub LateBinding()

  'Declare a generic object variable
  Dim objExcel As Object

  'Point the object variable at an Excel application object
  Set objExcel = CreateObject("Excel.Application")

  'Set properties and execute methods of the object
  With objExcel
   .Visible = True
   .Workbooks.Add
   .Range("A1") = "Hello World"
  End With
  End Sub

  二、使用CreateObject创建指定版本的Excel实例

  Sub mate()
  Dim objExcel As Object
  Set objExcel = CreateObject("Excel.Application.8")
  End Sub

  当Create对象实例之后,就可以使用该对象的所有属性和方法了,如SaveAs方法、Open方法、Application属性等。


该杂文来自: Excel杂文

上一篇:excel Criteria1实例

下一篇:VBA完全操作Excel单元格备注Cell Comments的代码

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计