乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 66|回复: 4

[求助]vba怎么不按语句顺序执行?

[复制链接]

61

主题

109

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
353
发表于 2004-11-15 17:31:00 | 显示全部楼层 |阅读模式
以下程序直接执行不可以,但如果在vbarun对话框选逐语句就可以运行.
开始时我想在对话框按下一个按纽,然后在图上选一个点,插入一个块,就用了sample的程序试了一下,结果对话框是焦点的情况下不能用utility的getpoint,只能在form1.hide之后才能utility.getpoint.后来发现,ThisDrawing.SendCommand 以后对话框还在,但不是焦点,可以用utility.getpoint,所以我想在getpoint前用一个空的指令,让对话框仍然显示在屏幕上,但不是焦点.
Private Sub CommandButton2_Click()
                               
                         Dim returnPnt As Variant
                               
                         ThisDrawing.SendCommand ("_open")
                         
                         returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
                         
                         
                         MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2) & vbCrLf & _
                                                                                         "(Enter the next value without prompting.)", , "GetPoint Example"
                               
                         returnPnt = ThisDrawing.Utility.GetPoint
                         MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetPoint Example"
                               
                         Dim basePnt(0 To 2) As Double
                         basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
                         returnPnt = ThisDrawing.Utility.GetPoint(basePnt, "Enter a point: ")
                         MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2)
                               
                         Dim lineObj As AcadLine
                         Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)
                         ZoomAll
                         UserForm1.Show
                         
End Sub

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

85

主题

1175

帖子

11

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1518
发表于 2004-11-15 19:03:00 | 显示全部楼层
哈哈,我也碰到过这个问题,也是插入块,一步步执行没问题,连续执行就出问题。没办法解决,后全部改为sendcommand.
回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2004-11-15 20:40:00 | 显示全部楼层
ThisDrawing.SendCommand ("_open")
?
什么意思
回复

使用道具 举报

61

主题

109

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
353
发表于 2004-11-16 08:51:00 | 显示全部楼层
ThisDrawing.SendCommand ("_open")
主要是为了让焦点回到autocad,可以传入一个空的指令.
不过我发现sendcommand好象一般到最后才执行,不知道为什么?
回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2004-11-16 09:33:00 | 显示全部楼层
让焦点回到autocad,用AppActivate Application.Caption
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-16 15:00 , Processed in 2.518370 second(s), 63 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表