明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1485|回复: 1

超链接问题!!!!

[复制链接]
发表于 2007-2-3 10:12:00 | 显示全部楼层 |阅读模式

怎样用VBA编写超链接,实现点击文字链接到另一个dwg上!!而不用命令hy**link一个一个定义??请帮忙!!!不胜感激!!!

发表于 2007-2-5 11:58:00 | 显示全部楼层
  1. Sub Example_HyperLinks()    ' This example creates a Circle object in model space and    ' adds a new Hyperlink to its Hyperlink collection        Dim Hyperlinks As AcadHyperlinks    Dim Hyperlink As AcadHyperlink    Dim circleObj As AcadCircle    Dim centerPoint(0 To 2) As Double    Dim radius As Double    Dim HLList As String        ' Define the Circle object    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0    radius = 5#        ' Create the Circle object in model space    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)    ThisDrawing.Application.ZoomAll        ' Get reference to the Circle's Hyperlinks collection    Set Hyperlinks = circleObj.Hyperlinks        ' Add a new Hyperlink complete with all properties    Set Hyperlink = Hyperlinks.Add("AutoDesk")    Hyperlink.URL = "www.autodesk.com"    Hyperlink.URLDescription = "Autodesk Main Site"    Hyperlink.URLNamedLocation = "MY_LOCATION"        ' Read and display a list of existing Hyperlinks and    ' their properties for this object    For Each Hyperlink In Hyperlinks        HLList = HLList & "____________________________________" & vbCrLf   ' Separator        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf    Next        MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLListEnd Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 20:44 , Processed in 0.154141 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表