adison 发表于 2005-3-28 12:35:00

如何调用cad系统的打开文件对话框?

如何调用cad系统的打开文件对话框?可以同时选择多个文件。

alin 发表于 2005-3-28 22:28:00

<A href="http://discussion.autodesk.com/thread.jspa?messageID=381741" target="_blank" >http://discussion.autodesk.com/thread.jspa?messageID=381741</A>

7lord 发表于 2007-8-3 16:12:00

没找到答案,望高人指点

yadg0 发表于 2007-8-6 09:14:00

<p>在vba菜单中,工程-&gt;组件 中加入microsoft common dialog,你再查查microsoft common dialog的用法.</p>

alin 发表于 2007-8-6 09:54:00

yadg0发表于2007-8-6 9:14:00static/image/common/back.gif在vba菜单中,工程-&gt;组件 中加入microsoft common dialog,你再查查microsoft common dialog的用法.

<p>This control is not licensed for all computers</p>

青青20 发表于 2007-8-9 09:08:00

<p>也可以使用API,在CAD VBA二次开发中写的非常详细.</p>

七敏 发表于 2007-11-9 19:54:00

问题是,我的VBA中根本没有“工程”这个菜单项啊?

waustin 发表于 2010-6-17 18:48:00

将filedia值设置为1。

洋葱老爹 发表于 2010-6-20 20:33:00

<p>新建一个用户窗体,在该窗体上添加一个按键控件,一个列表控件,一个通用对话框控件.然后添加如下代码,即可实现多文件选取,并将选取的文件的文件名添加到列表控件中:</p>
<p><font face="Verdana">Private Sub cmd_添加_Click()<br/>&nbsp;&nbsp;&nbsp; Dim I As Integer<br/>&nbsp;&nbsp;&nbsp; Dim Y As Integer<br/>&nbsp;&nbsp;&nbsp; Dim Z As Integer<br/>&nbsp;&nbsp;&nbsp; Dim FileNames() As String<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; On Error GoTo errHandle<br/>&nbsp;&nbsp;&nbsp; With comDlg<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .CancelError = True<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .MaxFileSize = 32767<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&amp;H4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 隐藏只读复选框<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&amp;H200&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 允许多重选择<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&amp;H8000&nbsp;&nbsp;&nbsp;&nbsp; 不能具有只读属性,也不能在写保护目录下面<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&amp;H80000&nbsp;&nbsp;&nbsp; 类似资源管理器的打开<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&amp;H100000&nbsp;&nbsp; 不要间接引用外壳链接(也称作快捷方式)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .flags = &amp;H4 Or &amp;H200 Or &amp;H8000 Or &amp;H80000 Or &amp;H100000<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .DialogTitle = "选择图形文件"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Filter = "图形文件(*.dwg)|*.dwg|所有文件(*.*)|*.*"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .fileName = ""<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .ShowOpen<br/>&nbsp;&nbsp;&nbsp; End With<br/>&nbsp;&nbsp;&nbsp; comDlg.fileName = comDlg.fileName &amp; Chr(0)&nbsp; '这些文件名是用空字符Chr(0)分隔符,而不是空格分隔符隔开<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Z = 1<br/>&nbsp;&nbsp;&nbsp; For I = 1 To Len(comDlg.fileName)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'InStr函数,返回 Variant (Long),指定一字符串在另一字符串中最先出现的位置。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '语法 InStr(起点位置, string1, string2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I = InStr(Z, comDlg.fileName, Chr(0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If I = 0 Then Exit For<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim Preserve FileNames(Y)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Mid函数,返回 Variant (String),其中包含字符串中指定数量的字符。语法 Mid(string, start[, length])<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileNames(Y) = Mid(comDlg.fileName, Z, I - Z)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Z = I + 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Y = Y + 1<br/>&nbsp;&nbsp;&nbsp; Next I</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; '向列表框中添加对象<br/>&nbsp;&nbsp;&nbsp; Dim count As Integer<br/>&nbsp;&nbsp;&nbsp; count = Lst_文件表.ListCount<br/>&nbsp;&nbsp;&nbsp; If Y = 1 Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lst_文件表.AddItem FileNames(Y - 1), count<br/>&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For I = 1 To Y - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileNames(I) = FileNames(0) &amp; "\" &amp; FileNames(I)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lst_文件表.AddItem FileNames(I), I - 1 + count<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next I<br/>&nbsp;&nbsp;&nbsp; End If</font></p>
<p><font face="Verdana">errHandle:<br/>End Sub</font></p>
页: [1]
查看完整版本: 如何调用cad系统的打开文件对话框?