请问下面一段程序怎么解释呀 实在看不明白,求详细解释
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/27 10:09:22
请问下面一段程序怎么解释呀 实在看不明白,求详细解释
Public Function Xls_OpenFileName() As String
Dim OF As OpenFilename, Temp As String, rtv As Long, Filter As String
Temp = String$(5120, vbNullChar)
Filter = "Microsoft Office Excel 文件 (*.xls)" & vbNullChar & "*.xls" & vbNullChar & vbNullChar
With OF
.lStructSize = Len(OF)
.hwndOwner = Application.hWndAccessApp
.lpstrFile = Temp
.nMaxFile = 5120
.lpstrFilter = Filter
.lpstrInitialDir = CurrentSelectpass
.nFilterIndex = 1
.Flags = &H4
.lpstrTitle = "请指定文件名"
End With
rtv = GetOpenFileName(OF)
If rtv Then
Xls_OpenFileName = Left$(OF.lpstrFile, InStr(OF.lpstrFile, vbNullChar) - 1)
' At Once the folder is selected one, it is maintaining.
CurrentSelectpass = Xls_OpenFileName
End If
End Function
Public Function Xls_OpenFileName() As String
Dim OF As OpenFilename, Temp As String, rtv As Long, Filter As String
Temp = String$(5120, vbNullChar)
Filter = "Microsoft Office Excel 文件 (*.xls)" & vbNullChar & "*.xls" & vbNullChar & vbNullChar
With OF
.lStructSize = Len(OF)
.hwndOwner = Application.hWndAccessApp
.lpstrFile = Temp
.nMaxFile = 5120
.lpstrFilter = Filter
.lpstrInitialDir = CurrentSelectpass
.nFilterIndex = 1
.Flags = &H4
.lpstrTitle = "请指定文件名"
End With
rtv = GetOpenFileName(OF)
If rtv Then
Xls_OpenFileName = Left$(OF.lpstrFile, InStr(OF.lpstrFile, vbNullChar) - 1)
' At Once the folder is selected one, it is maintaining.
CurrentSelectpass = Xls_OpenFileName
End If
End Function
Public Function Xls_OpenFileName() As String -方法名称:Xls_OpenFileName string类型
Dim OF As OpenFilename,Temp As String,rtv As Long,Filter As String -定义变量:of 打开文件名称,trmp string类型,filter string类型
Temp = String$(5120,vbNullChar) -temp 大小不能为空 最大5120K
Filter = "Microsoft Office Excel 文件 (*.xls)" & vbNullChar & "*.xls" & vbNullChar & vbNullChar
With OF -文件名称.xls
.lStructSize = Len(OF) -取长度
.hwndOwner = Application.hWndAccessApp -打开access一个方法
.lpstrFile = Temp -文件名
.nMaxFile = 5120 -文件最大值
.lpstrFilter = Filter -文件名
.lpstrInitialDir = CurrentSelectpass
.nFilterIndex = 1 -页码
.Flags = &H4 -编码
.lpstrTitle = "请指定文件名" -错误提示
End With
rtv = GetOpenFileName(OF)
If rtv Then
Xls_OpenFileName = Left$(OF.lpstrFile,InStr(OF.lpstrFile,vbNullChar) - 1)
' At Once the folder is selected one,it is maintaining.
CurrentSelectpass = Xls_OpenFileName
End If -判断文件是否选中
End Function -结束方法
Dim OF As OpenFilename,Temp As String,rtv As Long,Filter As String -定义变量:of 打开文件名称,trmp string类型,filter string类型
Temp = String$(5120,vbNullChar) -temp 大小不能为空 最大5120K
Filter = "Microsoft Office Excel 文件 (*.xls)" & vbNullChar & "*.xls" & vbNullChar & vbNullChar
With OF -文件名称.xls
.lStructSize = Len(OF) -取长度
.hwndOwner = Application.hWndAccessApp -打开access一个方法
.lpstrFile = Temp -文件名
.nMaxFile = 5120 -文件最大值
.lpstrFilter = Filter -文件名
.lpstrInitialDir = CurrentSelectpass
.nFilterIndex = 1 -页码
.Flags = &H4 -编码
.lpstrTitle = "请指定文件名" -错误提示
End With
rtv = GetOpenFileName(OF)
If rtv Then
Xls_OpenFileName = Left$(OF.lpstrFile,InStr(OF.lpstrFile,vbNullChar) - 1)
' At Once the folder is selected one,it is maintaining.
CurrentSelectpass = Xls_OpenFileName
End If -判断文件是否选中
End Function -结束方法