kernel64 发表于 2008-9-23 02:05:35

不引用组件实现的最小巧,最安全的能用对话框函数

<span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: 12px="12px"??????; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-ALIGN: left; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0"><span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: 12px="12px"??????; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; TEXT-ALIGN: left; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0">'MY CSDN ID boyzhang(爱你爱到Windows没BUG那天)<br/></span><br/>Option Explicit<span class="Apple-converted-space">&nbsp;</span><br/><br/>Public Function ShowOpen(Optional ByVal lpDialogTitle = "Open", Optional ByVal lpFilter = "All Files|*.*") As String<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; Dim objDialog As Object<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; Set objDialog = CreateObject("MSComDlg.CommonDialog")<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; With objDialog<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .DialogTitle = lpDialogTitle<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Filter = lpFilter<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ShowOpen<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowOpen = .FileName<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; End With<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; Set objDialog = Nothing<span class="Apple-converted-space">&nbsp;</span><br/>End Function<span class="Apple-converted-space">&nbsp;</span><br/><br/>Public Sub Main()<span class="Apple-converted-space">&nbsp;</span><br/>&nbsp; &nbsp; &nbsp; &nbsp; MsgBox ShowOpen()<span class="Apple-converted-space">&nbsp;</span><br/>End Sub<span class="Apple-converted-space">&nbsp;</span></span>

马大哈 发表于 2008-9-26 15:23:29

<p>哈哈,欢迎CSDN的朋友~~~~~~~~~</p>
<p>&nbsp;</p>
<p>最近电脑坏了,昨天才拿回来,惨啊惨啊~~</p>

马大哈 发表于 2008-10-2 01:29:53

<p>先以第一种写完代码.</p>
<p>&nbsp;</p>
<p>再把as IXMLDOMNode后面的类型作为字符串弄到CreateObject里去,按F2可以到对象浏览器里查到它是属于哪个库,从而得到父类,如你例子里的<font color="#ff0000">Microsoft</font></p>
页: [1]
查看完整版本: 不引用组件实现的最小巧,最安全的能用对话框函数