Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long
Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long
Dim bi As BROWSEINFO
Dim dwIList As Long
Dim szPath As String
Dim wPos As Integer
With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With
dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)
If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = ""
End If
End Function
Dim strMyFileNmWithPath as string
strMyFileNmWithPath = BrowseFolder("Describe window here")
If Len(strMyFileNmWithPath) > 0
'you got a file name; do something with it
Else
'user cancelled
End if
'OpenFile Dialog
Private Const OFN_ALLOWMULTISELECT = &H200
Private Const OFN_CREATEPROMPT = &H2000
Private Const OFN_ENABLEHOOK = &H20
Private Const OFN_ENABLETEMPLATE = &H40
Private Const OFN_ENABLETEMPLATEHANDLE = &H80
Private Const OFN_EXPLORER = &H80000
Private Const OFN_EXTENSIONDIFFERENT = &H400
Private Const OFN_FILEMUSTEXIST = &H1000
Private Const OFN_HIDEREADONLY = &H4
Private Const OFN_LONGNAMES = &H200000
Private Const OFN_NOCHANGEDIR = &H8
Private Const OFN_NODEREFERENCELINKS = &H100000
Private Const OFN_NOLONGNAMES = &H40000
Private Const OFN_NONETWORKBUTTON = &H20000
Private Const OFN_NOREADONLYRETURN = &H8000
Private Const OFN_NOTESTFILECREATE = &H10000
Private Const OFN_NOVALIDATE = &H100
Private Const OFN_OVERWRITEPROMPT = &H2
Private Const OFN_PATHMUSTEXIST = &H800
Private Const OFN_READONLY = &H1
Private Const OFN_SHAREAWARE = &H4000
Private Const OFN_SHAREFALLTHROUGH = 2
Private Const OFN_SHARENOWARN = 1
Private Const OFN_SHAREWARN = 0
Private Const OFN_SHOWHELP = &H10
Public Type tOpenFileName
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
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As tOpenFileName) As Long
Public Function GetFullFileName(ByVal pstrTitle As String, _
Optional ByVal pstrFilter As String = "", _
Optional ByVal pstrExtension As String = "", _
Optional ByVal pstrFolder As String = vbNullString, _
Optional ByVal pstrCurrentFile As String = vbNullString) _
As String
Dim ofn As tOpenFileName
Dim strFilter As String
Dim strFile As String
Dim frm As Form
Set frm = CodeContextObject
If (pstrFilter <> "" And pstrExtension <> "") Then
strFilter = vbNullString & pstrFilter & " (*." & pstrExtension & ")" & vbNullChar & "*." & pstrExtension
Else
strFilter = vbNullString & "All files (*.*)" & vbNullChar & "*.*"
End If
With ofn
.lStructSize = Len(ofn)
.hwndOwner = frm.hWnd
.lpstrFilter = strFilter & vbNullChar & vbNullChar
.nFilterIndex = 1
.lpstrFile = String(255, 0)
.nMaxFile = Len(.lpstrFile)
.lpstrFileTitle = String(255, 0)
.nMaxFileTitle = Len(.lpstrFileTitle)
.lpstrInitialDir = pstrFolder
.lpstrTitle = pstrTitle
.flags = OFN_OVERWRITEPROMPT Or OFN_HIDEREADONLY
.lpstrDefExt = pstrExtension
.lpstrFile = pstrCurrentFile
If GetOpenFileName(ofn) Then
strFile = Left$(.lpstrFileTitle, InStr(.lpstrFileTitle, vbNullChar) - 1)
strFile = CurDir & IIf(Right(CurDir, 1) <> "\", "\", "") & strFile
Else
strFile = vbNullString
End If
End With
Set frm = Nothing
GetFullFileName = Trim$(strFile)
End Function