乐筑天下

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

设置当前文档

[复制链接]

6

主题

22

帖子

5

银币

初来乍到

Rank: 1

铜币
46
发表于 2013-5-3 09:41:00 | 显示全部楼层 |阅读模式
public sub activedocument()
        dim olddoc as acaddocument
        set olddoc=thisdrawing.application.activedocument
        if Len(Dir("c:\test.dwg"))0 then
                thisdrawing.application.documents.open "c:\test.dwg"
        else
                msgbox "指定的文件不存在"
        end if
        thisdrawing.application.activedocument=olddoc
end sub
请教一下,如果当时CAD打开一个文件A.dwg, 然后运行这个VBA程序,C盘下也有test.dwg
那运行之后的效果是什么,test.dwg 是当前文档还是A.dwg
一本教材上的,看不大懂
回复

使用道具 举报

6

主题

22

帖子

5

银币

初来乍到

Rank: 1

铜币
46
发表于 2013-5-3 10:06:00 | 显示全部楼层
Public Sub openDialog()
    Dim strFileName As String
    '确保USERS1系统变量为空
    thisDrawing.SetVariable "USERS1", ""
    '显示"选择文件"对话框,并且获得用户选择的结果
    thisDrawing.sendcommand "(setvar "&" ""USERS1"""&"(getfield "&"""选择图形文件"""&"""d:/"""dwg"""&"8))"
    strFileName = thisDrawing.GetVariable("USERS1")
    '显示选择结果
    If Len(strFileName) = 0 Then
        MsgBox "为选择任何图形文件", vbInformation, "选择结果"
    Else
        MsgBox "选择的文件是:" & strFileName, vbInformation, "选择结果"
    End If
End Sub
红色的那句话是什么意思啊,那么多引号
回复

使用道具 举报

6

主题

22

帖子

5

银币

初来乍到

Rank: 1

铜币
46
发表于 2013-5-3 14:52:00 | 显示全部楼层
没有人回答一下?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-6-29 17:44 , Processed in 1.435725 second(s), 58 queries .

© 2020-2025 乐筑天下

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