收藏 分享(赏)

VBA代码汇总 VBA的基本内容.ppt

上传人:jinchen 文档编号:8035409 上传时间:2019-06-05 格式:PPT 页数:20 大小:1.19MB
下载 相关 举报
VBA代码汇总 VBA的基本内容.ppt_第1页
第1页 / 共20页
VBA代码汇总 VBA的基本内容.ppt_第2页
第2页 / 共20页
VBA代码汇总 VBA的基本内容.ppt_第3页
第3页 / 共20页
VBA代码汇总 VBA的基本内容.ppt_第4页
第4页 / 共20页
VBA代码汇总 VBA的基本内容.ppt_第5页
第5页 / 共20页
点击查看更多>>
资源描述

1、Agenda,宏录制,修改,录制宏 理解录制的宏 修改宏 运行宏 把宏加入工具条,宏、VBA、VB三种方式,Visual Basic ,VBA,VBScript之间的区别 VBScript(Visual Basic Script):VBScript是VB的一个子集。 1 更简单的VB解释语言。 2 可以调运CATIA对象。 3 没有数据类型的区别。系统总是动态的调用函数和对象属性。(迟绑定调用对象通过他们的dispatch接口) VBA(Visual Basic for Application):VBA是VB的一个子集。 1 VBA是程序中的主机,就象Word,Excel。 2 它提供了一个带

2、有编辑器、除错器、帮助、对象浏览器、完成器的完整的开发环境。 3 利用它的Tools-Reference菜单可以声明使用的对象库。这在完成和对象浏览器之间建立了 一个通道。 Visual Basic(Visual Basic专业版):VB是个完全的版本。 1 可以编制独立的程序。 2 也可以创建ActiveX和程序服务器。 3 可以被编译。 4 VB提供了自己的文档在线帮助,VB获取catia对象,VB基本语言介绍,VB基本语言介绍,Input & output,VB基本语言介绍,a = 2 & Val(“a“),b = Str(20),VB基本语言介绍,Input & output,VB基本

3、语言介绍,If 条件1 Then 语句块1 ElseIf 条件2 Then 语句块2 Else 语句块n+1 End If,Select Case 测试变量 Case 表达式1 语句块1 Case 表达式2 语句块2 Case Else 语句块n+1 End Select,选择结构,VB基本语言介绍,循环结构,For 变量=初值 To 终值 Step 步长 语句块 Next 变量,For Each 对象变量 In 对象集 语句块 Next 对象变量,Do While 条件表达式 语句块 Loop,Do While i 10 CATIA.Application.Caption = i i = i

4、 + 1 Loop,VB基本语言介绍,VB基本语言介绍,CATIA 结构,CATIA 结构,CATIA 结构,CATIA基本操作,CATIA编程基本流程,Documents和Document对象,添加一个文档:Part,Product,DrawingDim document1 As DocumentSet document1 = CATIA.Documents.Add(“Product“) 打开一个已经存在的文档:Set document1 = CATIA.Documents.Open(filename) 当前活动的文档:On Error Resume NextSet document1 =

5、CATIA.ActiveDocumentIf document1 Is Nothing ThenErr.ClearSet document1 = CATIA.Documents.Add(“Part”) document1.activateEnd if,CATIA.Documents. Add CATIA.Documents. Count CATIA.Documents. Name CATIA.Documents. NewFrom CATIA.Documents. Open,Documents和Document对象,示例:依次激活文档Dim count1 As Integercount1 = C

6、ATIA.Documents.CountFor i = 1 To count1CATIA.Documents.Item(i).ActivateNext 输出为其他格式:例如CGRdoc.ExportData “c:aa“, “cgr“,document.Activate document.Save document.SaveAs document.Close document.ExportData,Windows和Window对象,逐个显示窗口名称:Dim document1 As DocumentSet document1 = CATIA.ActiveDocumentDim mywindow As WindowMsgBox CATIA.Windows.CountFor Each mywindow In CATIA.Windowsmywindow.ActivateMsgBox mywindow.NameNext,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报