乐筑天下

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

[编程交流] VBA - returning individual att

[复制链接]

16

主题

43

帖子

33

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
85
发表于 2022-7-6 23:25:15 | 显示全部楼层
Ha! Fishing has not been very productive this year. Way too busy with my fourth child only 8 months old.
 
OK, with the help I received here and my other research and the beginning of a bald spot on the side of my head from scratching while thinking, I was able to get this to work. I'm not sure how stable it is but it works. If anyone want's to adjust it to make it better - please feel free! I don't get my feelings easily hurt from constructive critism! Just ask Oleg. I can't tell you how many times he has reached over the internet and thumped me in the head!
 
  1. Option ExplicitSub Example_GetSubEntity()   Dim Object As Object   Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant   Dim MyStyle As String   Dim MyWidth As Integer   Dim i As Integer   Dim REPLY As String   MyStyle = "STANDARD"   MyWidth = 1#   On Error GoTo NOT_ENTITYTRYAGAIN:Do   ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData           If Not Object.StyleName = MyStyle Then           Object.StyleName = MyStyle           Object.ScaleFactor = MyWidth           End If           Object.UpdateLoop   Exit SubNOT_ENTITY:   REPLY = MsgBox("                   You have not selected an attribute" & vbCr & vbCr & "Press RETRY to continue or CANCEL to end the macro", vbRetryCancel, "                    A SPECIAL MESSAGE JUST FOR YOU")   If REPLY = 4 Then   Resume TRYAGAIN   End IfEnd Sub
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 23:28:46 | 显示全部楼层
If you used 'Option Explicit' better yet to cast all object
explicitly, so you have to cast an object as AttributeReference
Set attRef = Object
then change its properties, you will be avoid many mistakes
in your code
I posted you another loop example, sorry, not tested
See you,
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 11:27 , Processed in 0.756522 second(s), 54 queries .

© 2020-2025 乐筑天下

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