- Código:
Public Function Buscar(lngHwnd As Long, strTítulo As String, strPastaInicial As String, strFiltro As String) As String
Dim filebox As OPENFILENAME
Dim result As Long
With filebox
.lStructSize = Len(filebox)
.hwndOwner = lngHwnd
.hInstance = 0
.lpstrFilter = strFiltro & vbNullChar & _
"Todos os Arquivos (*.*)" & vbNullChar & "*.*" & vbNullChar & vbNullChar
.nMaxCustomFilter = 0
.nFilterIndex = 1
.lpstrFile = Space(256) & vbNullChar
.nMaxFile = Len(.lpstrFile)
.lpstrFileTitle = Space(256) & vbNullChar
.nMaxFileTitle = Len(.lpstrFileTitle)
.lpstrInitialDir = strPastaInicial & vbNullChar
.lpstrTitle = strTítulo & vbNullChar
.flags = OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY
.nFileOffset = 0
.nFileExtension = 0
.lCustData = 0
.lpfnHook = 0
End With
result = GetOpenFileName(filebox)
If result <> 0 Then
Buscar = Left(filebox.lpstrFile, InStr(filebox.lpstrFile, vbNullChar) - 1)
Else
Buscar = ""
End If
erro para anexar as fotos
- Código:
Public Function Buscar(lngHwnd As Long, strTítulo As String, strPastaInicial As String, strFiltro As String) As String
Dim filebox As OPENFILENAME
Dim result As Long
With filebox
.lStructSize = Len(filebox)
.hwndOwner = lngHwnd
.hInstance = 0
.lpstrFilter = strFiltro & vbNullChar & _
"Todos os Arquivos (*.*)" & vbNullChar & "*.*" & vbNullChar & vbNullChar
.nMaxCustomFilter = 0
.nFilterIndex = 1
.lpstrFile = Space(256) & vbNullChar
.nMaxFile = Len(.lpstrFile)
.lpstrFileTitle = Space(256) & vbNullChar
.nMaxFileTitle = Len(.lpstrFileTitle)
.lpstrInitialDir = strPastaInicial & vbNullChar
.lpstrTitle = strTítulo & vbNullChar
.flags = OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY
.nFileOffset = 0
.nFileExtension = 0
.lCustData = 0
.lpfnHook = 0
End With
result = GetOpenFileName(filebox)
If result <> 0 Then
Buscar = Left(filebox.lpstrFile, InStr(filebox.lpstrFile, vbNullChar) - 1)
Else
Buscar = ""
End If
End Function