- UID
- 18608
- 积分
- 2508
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-12-4
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Selecting file with stardard AutoCAD file/open dialog
ID 42014
Applies to: AutoCAD 2000
Date 5/8/2000
This document is part of COM-ActiveX Interfaces Opening Drawings VBA
Question
Can I gain access to the "Open File Dialog" (with preview) found only in AutoCAD
with VBA?
Answer
There is no explicit API to do this VBA. However, you can do this through the
communication interface with AutoLISP and AutoCAD. The AutoLISP function,
getfiled, behaves as the AutoCAD "Open File Dialog" and allows .DWG files to be
previewed.
The attached VBA code shows how to do it. Here's an overview:
1. Using the SendCommand method, send getfiled AutoLISP expressions to the
AutoCAD command line.
2. Set the return value to a user-defined system variable USERS1.
3. Use the GetVariable method to retrieve this system variable to store the
selected file name. 4. Use the file name in your VBA code as other variables.
Public Sub OpenDialog()
Dim fileName As String
ThisDrawing.SendCommand "(setvar " & """users1""" & "(getfiled " & """Select
a DWG File""" & """c:/program files/acad2000/""" & """dwg""" & "8)) "
fileName = ThisDrawing.GetVariable("users1")
MsgBox "You have selected " & fileName & "!!!", , "File Message"
End Sub |
|