标题: 同时引用一个模块时出现"二义性名称"该如何做? [打印本页] 作者: sunny-xie 时间: 2008-2-18 15:37 标题: 同时引用一个模块时出现"二义性名称"该如何做? 模块内容:
Option Compare Database
Option Explicit
Public Function FileExistCheck(ByVal strfilename As String) As Integer
''测试路径是否有效
'这段代码更好
'返回0代表文件或路径不存在
'返回1代表该文件存在
'返回2代表该文件夹存在
Dim intAttr As Integer
On Error GoTo Err:
FileExistCheck = 0
If Len(strfilename) > 0 Then
intAttr = GetAttr(strfilename)
If (intAttr And vbDirectory) Then
FileExistCheck = 2 '
Else
FileExistCheck = 1 '
End If
End If
Exit Function
Err:
End Function
引用地方1:
Private Sub Command246_Click()
Dim lngRe As Long
Dim tempth As String
Dim fulltempth As String
tempth = "\\192.168.56.10\Application\lighting\Report\"
fulltempth = tempth & Me.zuhe1.Value & "报告书.pdf"
If FileExistCheck(fulltempth) = 0 Then
MsgBox "文件不存在!"
Exit Sub
End If
lngRe = ShellExecute(Me.hwnd, "open", tempth & Me.zuhe1.Value & "报告书.pdf", vbNullString, vbNullString, SW_SHOWNORMAL)
If lngRe = SE_ERR_NOASSOC Then
Shell "rundll32 shell32,OpenAs_RunDLL " & tempth & Me.zuhe1.Value & "报告书.pdf", vbNormalFocus
End If