Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: ???????
Re: код покажите. Стоит Office 2003 prof
Код:

Private Declare Function ap_GetOpenFileName Lib "comdlg32.dll" _
Alias "OpenFile" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Const cdlOFNAllowMultiselect = &H200
Const cdlOFNCreatePrompt = &H2000
Const cdlOFNExplorer = &H80000
Const cdlOFNExtensionDifferent = &H400
Const cdlOFNFileMustExist = &H1000
Const cdlOFNHelpButton = &H10
Const cdlOFNHideReadOnly = &H4
Const cdlOFNLongNames = &H200000
Const cdlOFNNoChangeDir = &H8
Const cdlOFNNoDereferenceLinks = &H100000
Const cdlOFNNoLongNames = &H40000
Const cdlOFNNoReadOnlyReturn = &H8000
Const cdlOFNNoValidate = &H100
Const cdlOFNOverwritePrompt = &H2
Const cdlOFNPathMustExist = &H800
Const cdlOFNReadOnly = &H1
Const cdlOFNShareAware = &H4000

Public Function ap_OpenFile(Optional ByVal strFileNameIn _
As String = "", Optional strDialogTitle _
As String = "Name of File to Open")

Dim lngReturn As Long
Dim intLocNull As Integer
Dim strTemp As String
Dim ofnFileInfo As OPENFILENAME
Dim strInitialDir As String
Dim strFileName As String

If InStr(strFileNameIn, "") <> 0 Then
strInitialDir = Left(strFileNameIn, InStrRev(strFileNameIn, ""))
strFileName = Left(Mid$(strFileNameIn, InStrRev(strFileNameIn, "") + 1) & String(256, 0), 256)
Else
strInitialDir = CurrentProject.Path
strFileName = Left(strFileNameIn & String(256, 0), 256)
End If

With ofnFileInfo
.lStructSize = Len(ofnFileInfo)
.lpstrFile = strFileName
.lpstrFileTitle = String(256, 0)
.lpstrInitialDir = strInitialDir
.hwndOwner = Application.hWndAccessApp
.lpstrFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0)
.nFilterIndex = 1
.nMaxFile = Len(strFileName)
.nMaxFileTitle = ofnFileInfo.nMaxFile
.lpstrTitle = strDialogTitle
.flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNNoChangeDir
.hInstance = 0
.lpstrCustomFilter = String(255, 0)
.nMaxCustFilter = 255
.lpfnHook = 0
End With

lngReturn = ap_GetOpenFileName(ofnFileInfo)
If lngReturn = 0 Then
strTemp = ""
Else
strTemp = Trim(ofnFileInfo.lpstrFile)
intLocNull = InStr(strTemp, Chr(0))
If intLocNull Then
strTemp = Left(strTemp, intLocNull - 1)
End If
End If

ap_OpenFile = strTemp

End Function


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.