browse for folder code

I am using this code to browse for a folder (just folders no files) in
Access 2007.
It works great, I just want one extra feature:
- to supply a starting folder

I found one example on stephen lebans site
http://www.lebans.com/callbackbrowser.htm
but it required the code to exist in the code behind the form.
I use this on about 10 forms so would prefer something that I could place in
just one module.

Does anyone have a better solution?
Thanks in advance,
Mark

--------------------------------
Option Compare Database
Option Explicit

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
Private Const BIF_NEWDIALOGSTYLE = &H40

Public Function BrowseFolder(szDialogTitle As String) As String
  Dim X As Long, bi As BROWSEINFO, dwIList As Long
  Dim szPath As String, wPos As Integer

    With bi
        .hOwner = hWndAccessApp
        .lpszTitle = szDialogTitle
        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
    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 = vbNullString
    End If
End Function
----------------------------------------
 

0
Mark
5/14/2010 10:43:50 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

20 Replies
1447 Views

Similar Articles

[PageSpeed] 30

Try this, which is where the original code that Stephen used came from:

http://www.mvps.org/access/api/api0002.htm
-- 
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>I am using this code to browse for a folder (just folders no files) in
> Access 2007.
> It works great, I just want one extra feature:
> - to supply a starting folder
>
> I found one example on stephen lebans site
> http://www.lebans.com/callbackbrowser.htm
> but it required the code to exist in the code behind the form.
> I use this on about 10 forms so would prefer something that I could place 
> in
> just one module.
>
> Does anyone have a better solution?
> Thanks in advance,
> Mark
>
> --------------------------------
> Option Compare Database
> Option Explicit
>
> 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
> Private Const BIF_NEWDIALOGSTYLE = &H40
>
> Public Function BrowseFolder(szDialogTitle As String) As String
>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>  Dim szPath As String, wPos As Integer
>
>    With bi
>        .hOwner = hWndAccessApp
>        .lpszTitle = szDialogTitle
>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>    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 = vbNullString
>    End If
> End Function
> ----------------------------------------
>
> 


0
Arvin
5/14/2010 11:22:55 PM
"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>I am using this code to browse for a folder (just folders no files) in
> Access 2007.
> It works great, I just want one extra feature:
> - to supply a starting folder
>
> I found one example on stephen lebans site
> http://www.lebans.com/callbackbrowser.htm
> but it required the code to exist in the code behind the form.
> I use this on about 10 forms so would prefer something that I could place 
> in
> just one module.

Put it this way. If Stephen couldn't make it work with the code in a single 
common module, it can't be done.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)



0
Douglas
5/14/2010 11:56:23 PM
Hi Mark
I have been using this function for a long time.  Think it did start from 
someone else but I have tweaked it over the years.  Basically you pass the 
form name and an optional starting path.  It will return the file name.  You 
will have to tweak it to only return the folder, but that should not be too 
hard.

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (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
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
End Type

Hope this helps

'---------------------------------------------------------------------------------------
' Procedure : funBrowse
' Author    : Neville Turbit
' Date      : 04/06/09
' Purpose   : Function to search all files.
'---------------------------------------------------------------------------------------
'
Function funBrowse(strform As Form, Optional strPath As String) As String

    On Error GoTo Error_funBrowse

    Dim OpenFile As OPENFILENAME
    Dim lReturn As Long
    Dim sFilter As String
    
    OpenFile.lStructSize = Len(OpenFile)
    OpenFile.hwndOwner = strform.hWnd
    
    ' Don't filter the files
    sFilter = "All Files (*.*)" & Chr(0) & "*.*" '& Chr(0) & _
      "JPEG Files (*.JPG)" & Chr(0) & "*.JPG" & Chr(0)
    OpenFile.lpstrFilter = sFilter
    OpenFile.nFilterIndex = 1
    
    OpenFile.lpstrFile = String(257, 0)
    OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
    OpenFile.lpstrFileTitle = OpenFile.lpstrFile
    OpenFile.nMaxFileTitle = OpenFile.nMaxFile
    
    ' Set the initial directory
    If IsNull(strPath) Then
        OpenFile.lpstrInitialDir = "C:\"
      Else
        OpenFile.lpstrInitialDir = strPath
    End If
    
    OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
    OpenFile.flags = 0
    
    lReturn = GetOpenFileName(OpenFile)
        If lReturn = 0 Then
            MsgBox "A file was not selected!", vbInformation, _
              "Select a file using the Common Dialog DLL"
         Else
            funBrowse = Trim(Left(OpenFile.lpstrFile, InStr(1, 
OpenFile.lpstrFile, vbNullChar) - 1))
         End If

Exit_funBrowse:
    On Error GoTo 0
    Exit Function

Error_funBrowse:

    MsgBox "An unexpected situation arose in your program." & funCrLf & _
           "Please write down the following details:" & funCrLf & funCrLf & _
           "Module Name: modGeneric" & funCrLf & _
           "Type: Module" & funCrLf & _
           "Calling Procedure: funBrowse" & funCrLf & _
           "Error Number: " & Err.Number & funCrLf & _
           "Error Descritption: " & Err.Description
           
    Resume Exit_funBrowse
End Function



"Douglas J. Steele" wrote:

> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
> >I am using this code to browse for a folder (just folders no files) in
> > Access 2007.
> > It works great, I just want one extra feature:
> > - to supply a starting folder
> >
> > I found one example on stephen lebans site
> > http://www.lebans.com/callbackbrowser.htm
> > but it required the code to exist in the code behind the form.
> > I use this on about 10 forms so would prefer something that I could place 
> > in
> > just one module.
> 
> Put it this way. If Stephen couldn't make it work with the code in a single 
> common module, it can't be done.
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
> 
> 
> 
> .
> 
0
Utf
5/15/2010 8:13:01 AM
Ooops.  Put the text "hope this helps" in the wrong place.  Sorry.

"NevilleT" wrote:

> Hi Mark
> I have been using this function for a long time.  Think it did start from 
> someone else but I have tweaked it over the years.  Basically you pass the 
> form name and an optional starting path.  It will return the file name.  You 
> will have to tweak it to only return the folder, but that should not be too 
> hard.
> 
> Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
> "GetOpenFileNameA" (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
>     nFileExtension As Integer
>     lpstrDefExt As String
>     lCustData As Long
>     lpfnHook As Long
>     lpTemplateName As String
> End Type
> 
> Hope this helps
> 
> '---------------------------------------------------------------------------------------
> ' Procedure : funBrowse
> ' Author    : Neville Turbit
> ' Date      : 04/06/09
> ' Purpose   : Function to search all files.
> '---------------------------------------------------------------------------------------
> '
> Function funBrowse(strform As Form, Optional strPath As String) As String
> 
>     On Error GoTo Error_funBrowse
> 
>     Dim OpenFile As OPENFILENAME
>     Dim lReturn As Long
>     Dim sFilter As String
>     
>     OpenFile.lStructSize = Len(OpenFile)
>     OpenFile.hwndOwner = strform.hWnd
>     
>     ' Don't filter the files
>     sFilter = "All Files (*.*)" & Chr(0) & "*.*" '& Chr(0) & _
>       "JPEG Files (*.JPG)" & Chr(0) & "*.JPG" & Chr(0)
>     OpenFile.lpstrFilter = sFilter
>     OpenFile.nFilterIndex = 1
>     
>     OpenFile.lpstrFile = String(257, 0)
>     OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
>     OpenFile.lpstrFileTitle = OpenFile.lpstrFile
>     OpenFile.nMaxFileTitle = OpenFile.nMaxFile
>     
>     ' Set the initial directory
>     If IsNull(strPath) Then
>         OpenFile.lpstrInitialDir = "C:\"
>       Else
>         OpenFile.lpstrInitialDir = strPath
>     End If
>     
>     OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
>     OpenFile.flags = 0
>     
>     lReturn = GetOpenFileName(OpenFile)
>         If lReturn = 0 Then
>             MsgBox "A file was not selected!", vbInformation, _
>               "Select a file using the Common Dialog DLL"
>          Else
>             funBrowse = Trim(Left(OpenFile.lpstrFile, InStr(1, 
> OpenFile.lpstrFile, vbNullChar) - 1))
>          End If
> 
> Exit_funBrowse:
>     On Error GoTo 0
>     Exit Function
> 
> Error_funBrowse:
> 
>     MsgBox "An unexpected situation arose in your program." & funCrLf & _
>            "Please write down the following details:" & funCrLf & funCrLf & _
>            "Module Name: modGeneric" & funCrLf & _
>            "Type: Module" & funCrLf & _
>            "Calling Procedure: funBrowse" & funCrLf & _
>            "Error Number: " & Err.Number & funCrLf & _
>            "Error Descritption: " & Err.Description
>            
>     Resume Exit_funBrowse
> End Function
> 
> 
> 
> "Douglas J. Steele" wrote:
> 
> > "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> > news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
> > >I am using this code to browse for a folder (just folders no files) in
> > > Access 2007.
> > > It works great, I just want one extra feature:
> > > - to supply a starting folder
> > >
> > > I found one example on stephen lebans site
> > > http://www.lebans.com/callbackbrowser.htm
> > > but it required the code to exist in the code behind the form.
> > > I use this on about 10 forms so would prefer something that I could place 
> > > in
> > > just one module.
> > 
> > Put it this way. If Stephen couldn't make it work with the code in a single 
> > common module, it can't be done.
> > 
> > -- 
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no private e-mails, please)
> > 
> > 
> > 
> > .
> > 
0
Utf
5/15/2010 8:15:01 AM
Thanks, however that's what I am using right now.
Mark

"Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
> Try this, which is where the original code that Stephen used came from:
>
> http://www.mvps.org/access/api/api0002.htm
> -- 
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
>
>
> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>I am using this code to browse for a folder (just folders no files) in
>> Access 2007.
>> It works great, I just want one extra feature:
>> - to supply a starting folder
>>
>> I found one example on stephen lebans site
>> http://www.lebans.com/callbackbrowser.htm
>> but it required the code to exist in the code behind the form.
>> I use this on about 10 forms so would prefer something that I could place 
>> in
>> just one module.
>>
>> Does anyone have a better solution?
>> Thanks in advance,
>> Mark
>>
>> --------------------------------
>> Option Compare Database
>> Option Explicit
>>
>> 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
>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>
>> Public Function BrowseFolder(szDialogTitle As String) As String
>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>  Dim szPath As String, wPos As Integer
>>
>>    With bi
>>        .hOwner = hWndAccessApp
>>        .lpszTitle = szDialogTitle
>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>    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 = vbNullString
>>    End If
>> End Function
>> ----------------------------------------
>>
>>
>
> 
0
Mark
5/15/2010 12:21:01 PM
Yea I think you are right.
Mark

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message 
news:uFYPPE88KHA.3276@TK2MSFTNGP02.phx.gbl...
> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>I am using this code to browse for a folder (just folders no files) in
>> Access 2007.
>> It works great, I just want one extra feature:
>> - to supply a starting folder
>>
>> I found one example on stephen lebans site
>> http://www.lebans.com/callbackbrowser.htm
>> but it required the code to exist in the code behind the form.
>> I use this on about 10 forms so would prefer something that I could place 
>> in
>> just one module.
>
> Put it this way. If Stephen couldn't make it work with the code in a 
> single common module, it can't be done.
>
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> 
0
Mark
5/15/2010 12:21:25 PM
Thanks, however this is not quite what I want.
Mark

"NevilleT" <NevilleT@discussions.microsoft.com> wrote in message 
news:466F577E-3EBE-4FD5-B467-FDE1335A5CFC@microsoft.com...
> Hi Mark
> I have been using this function for a long time.  Think it did start from
> someone else but I have tweaked it over the years.  Basically you pass the
> form name and an optional starting path.  It will return the file name. 
> You
> will have to tweak it to only return the folder, but that should not be 
> too
> hard.
>
> Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
> "GetOpenFileNameA" (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
>    nFileExtension As Integer
>    lpstrDefExt As String
>    lCustData As Long
>    lpfnHook As Long
>    lpTemplateName As String
> End Type
>
> Hope this helps
>
> '---------------------------------------------------------------------------------------
> ' Procedure : funBrowse
> ' Author    : Neville Turbit
> ' Date      : 04/06/09
> ' Purpose   : Function to search all files.
> '---------------------------------------------------------------------------------------
> '
> Function funBrowse(strform As Form, Optional strPath As String) As String
>
>    On Error GoTo Error_funBrowse
>
>    Dim OpenFile As OPENFILENAME
>    Dim lReturn As Long
>    Dim sFilter As String
>
>    OpenFile.lStructSize = Len(OpenFile)
>    OpenFile.hwndOwner = strform.hWnd
>
>    ' Don't filter the files
>    sFilter = "All Files (*.*)" & Chr(0) & "*.*" '& Chr(0) & _
>      "JPEG Files (*.JPG)" & Chr(0) & "*.JPG" & Chr(0)
>    OpenFile.lpstrFilter = sFilter
>    OpenFile.nFilterIndex = 1
>
>    OpenFile.lpstrFile = String(257, 0)
>    OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
>    OpenFile.lpstrFileTitle = OpenFile.lpstrFile
>    OpenFile.nMaxFileTitle = OpenFile.nMaxFile
>
>    ' Set the initial directory
>    If IsNull(strPath) Then
>        OpenFile.lpstrInitialDir = "C:\"
>      Else
>        OpenFile.lpstrInitialDir = strPath
>    End If
>
>    OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
>    OpenFile.flags = 0
>
>    lReturn = GetOpenFileName(OpenFile)
>        If lReturn = 0 Then
>            MsgBox "A file was not selected!", vbInformation, _
>              "Select a file using the Common Dialog DLL"
>         Else
>            funBrowse = Trim(Left(OpenFile.lpstrFile, InStr(1,
> OpenFile.lpstrFile, vbNullChar) - 1))
>         End If
>
> Exit_funBrowse:
>    On Error GoTo 0
>    Exit Function
>
> Error_funBrowse:
>
>    MsgBox "An unexpected situation arose in your program." & funCrLf & _
>           "Please write down the following details:" & funCrLf & funCrLf & 
> _
>           "Module Name: modGeneric" & funCrLf & _
>           "Type: Module" & funCrLf & _
>           "Calling Procedure: funBrowse" & funCrLf & _
>           "Error Number: " & Err.Number & funCrLf & _
>           "Error Descritption: " & Err.Description
>
>    Resume Exit_funBrowse
> End Function
>
>
>
> "Douglas J. Steele" wrote:
>
>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message
>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>> >I am using this code to browse for a folder (just folders no files) in
>> > Access 2007.
>> > It works great, I just want one extra feature:
>> > - to supply a starting folder
>> >
>> > I found one example on stephen lebans site
>> > http://www.lebans.com/callbackbrowser.htm
>> > but it required the code to exist in the code behind the form.
>> > I use this on about 10 forms so would prefer something that I could 
>> > place
>> > in
>> > just one module.
>>
>> Put it this way. If Stephen couldn't make it work with the code in a 
>> single
>> common module, it can't be done.
>>
>> -- 
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>>
>> .
>> 
0
Mark
5/15/2010 12:23:33 PM
You added a bit:

Private Const BIF_NEWDIALOGSTYLE = &H40
and
..ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
-- 
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:%234gA%23jC9KHA.5848@TK2MSFTNGP06.phx.gbl...
> Thanks, however that's what I am using right now.
> Mark

> "Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
> news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
>> Try this, which is where the original code that Stephen used came from:
>>
>> http://www.mvps.org/access/api/api0002.htm
>> -- 
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.accessmvp.com
>> http://www.mvps.org/access
>>
>>
>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>>I am using this code to browse for a folder (just folders no files) in
>>> Access 2007.
>>> It works great, I just want one extra feature:
>>> - to supply a starting folder
>>>
>>> I found one example on stephen lebans site
>>> http://www.lebans.com/callbackbrowser.htm
>>> but it required the code to exist in the code behind the form.
>>> I use this on about 10 forms so would prefer something that I could 
>>> place in
>>> just one module.
>>>
>>> Does anyone have a better solution?
>>> Thanks in advance,
>>> Mark
>>>
>>> --------------------------------
>>> Option Compare Database
>>> Option Explicit
>>>
>>> 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
>>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>>
>>> Public Function BrowseFolder(szDialogTitle As String) As String
>>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>>  Dim szPath As String, wPos As Integer
>>>
>>>    With bi
>>>        .hOwner = hWndAccessApp
>>>        .lpszTitle = szDialogTitle
>>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>>    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 = vbNullString
>>>    End If
>>> End Function
>>> ----------------------------------------
>>>
>>>
>>
>> 


0
Arvin
5/15/2010 3:12:55 PM
"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:%234gA%23jC9KHA.5848@TK2MSFTNGP06.phx.gbl...
> Thanks, however that's what I am using right now.
> Mark
>
> "Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
> news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
>> Try this, which is where the original code that Stephen used came from:
>>
>> http://www.mvps.org/access/api/api0002.htm
>> -- 
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.accessmvp.com
>> http://www.mvps.org/access
>>
>>
>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>>I am using this code to browse for a folder (just folders no files) in
>>> Access 2007.
>>> It works great, I just want one extra feature:
>>> - to supply a starting folder
>>>
>>> I found one example on stephen lebans site
>>> http://www.lebans.com/callbackbrowser.htm
>>> but it required the code to exist in the code behind the form.
>>> I use this on about 10 forms so would prefer something that I could 
>>> place in
>>> just one module.
>>>
>>> Does anyone have a better solution?
>>> Thanks in advance,
>>> Mark
>>>
>>> --------------------------------
>>> Option Compare Database
>>> Option Explicit
>>>
>>> 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
>>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>>
>>> Public Function BrowseFolder(szDialogTitle As String) As String
>>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>>  Dim szPath As String, wPos As Integer
>>>
>>>    With bi
>>>        .hOwner = hWndAccessApp
>>>        .lpszTitle = szDialogTitle
>>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>>    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 = vbNullString
>>>    End If
>>> End Function
>>> ----------------------------------------

Hi Mark

Unfortunately the browse folder dialog code wasn't written with VBA in mind. 
You have to use a callback function in order to get the dialog to display 
the initial folder selection. If anything causes VBA to go into break mode 
while this is executing, Access will probably crash. That said, here is the 
code you need. Create a class module (call it clsBrowseFolder) and paste in 
the following:

''' Start Code '''
Option Compare Database
Option Explicit
'
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 SHGetPathFromIDListA Lib "shell32.dll" _
    (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolderA Lib "shell32.dll" _
    (lpBrowseInfo As BROWSEINFO) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (pDest As Any, pSource As Any, ByVal dwLength As Long)

Private Declare Function LocalAlloc Lib "kernel32" _
    (ByVal uFlags As Long, ByVal uBytes As Long) As Long
Private Declare Function LocalFree Lib "kernel32" _
    (ByVal hMem As Long) As Long
Private Const LPTR = (&H0 Or &H40)
'
Private m_Caption As String
Private m_InitDir As String
Private m_ReturnDir As String
Private m_UserCancel As Boolean
Private m_hWndOwner As Long
Private m_ErrOption As Long

Public Property Get Caption() As String
    Caption = m_Caption
End Property
Public Property Let Caption(NewData As String)
    If Len(NewData) > 50 Then
        Err.Raise vbObjectError + 1, _
            "clsFolderDialog.Caption", _
            "Caption too long. 50 chars max."
    End If
    m_Caption = NewData
End Property

Public Property Let InitDir(NewData As String)
    m_InitDir = NewData
End Property

Public Property Get ReturnDir() As String
    ReturnDir = m_ReturnDir
End Property

Public Property Get UserCancel() As Boolean
    UserCancel = m_UserCancel
End Property

Public Property Let hWndOwner(NewData As Long)
    m_hWndOwner = NewData
End Property

Public Sub Execute()
    Dim bi As BROWSEINFO
    Dim Buffer As String
    Dim PathPtr As Long
    Dim itemID As Long
    '
    With bi
        .hOwner = m_hWndOwner
        .ulFlags = 1
        .lpszTitle = m_Caption
        .lpfn = FuncPtr(AddressOf BrowseFolderHookProc)
        PathPtr = LocalAlloc(LPTR, Len(m_InitDir) + 1)
        CopyMemory ByVal PathPtr, ByVal m_InitDir, Len(m_InitDir) + 1
        .lParam = PathPtr
    End With
    Buffer = Space$(512)
    itemID = SHBrowseForFolderA(bi)
    If SHGetPathFromIDListA(itemID, Buffer) Then
        m_ReturnDir = Left(Buffer, InStr(Buffer, vbNullChar) - 1)
    Else
        m_UserCancel = True
    End If
    CoTaskMemFree itemID
    LocalFree PathPtr
End Sub

Private Sub Class_Initialize()
    m_Caption = "Please Select Folder"
    With Application
        m_hWndOwner = .hWndAccessApp
        m_ErrOption = .GetOption("Error Trapping")
        .SetOption "Error Trapping", 2
    End With
End Sub

Private Sub Class_Terminate()
    On Error Resume Next
    Application.SetOption "Error Trapping", m_ErrOption
End Sub

Private Function FuncPtr(pFunc As Long) As Long
    FuncPtr = pFunc
End Function
''' End Code '''

Then create a standard module (call it modBrowseFolder) and paste in the 
following:

''' Start Code '''
Option Compare Database
Option Explicit
'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hWnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any) As Long
'
Private Const WM_USER = &H400
Private Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
Private Const BFFM_SETSELECTIONW As Long = (WM_USER + 103)

Public Function BrowseFolderHookProc(ByVal hWnd As Long, ByVal uMsg As Long, 
_
    ByVal lParam As Long, ByVal lpData As Long) As Long
    If uMsg = 1 Then
        Call SendMessage(hWnd, BFFM_SETSELECTIONA, True, ByVal lpData)
    End If
End Function
''' End Code '''

A simple test:

With New clsBrowseFolder
    .hwndOwner = Application.hWndAccessApp
    .InitDir = "c:\temp"
    .Execute
    If Not .UserCancel Then
        MsgBox "Selected Folder: " & .ReturnDir
    End If
End With

Hope that helps.


0
Stuart
5/15/2010 3:41:37 PM
' I don't know where I got this...
' Requires a reference to 'Microsoft Shell Controls and Automation'.
Sub TestIt()
    
    MsgBox GetFolderPath("C:\Documents and Settings")
   
End Sub


Function GetFolderPath(Optional vntOpenAt As Variant) As String
    Dim Shell      As New Shell32.Shell
    Dim Folder     As Shell32.Folder
    Dim FolderItem As Shell32.FolderItem
    
    Set Folder = Shell.BrowseForFolder(0, "Please choose a folder", 0, 
vntOpenAt)
    
    If Not Folder Is Nothing Then
       Set FolderItem = Folder.Self
       GetFolderPath = FolderItem.Path
    End If
   
End Function




-- 
A nod is as good as a wink to a blind horse.


"Mark Andrews" wrote:

> I am using this code to browse for a folder (just folders no files) in
> Access 2007.
> It works great, I just want one extra feature:
> - to supply a starting folder
> 
> I found one example on stephen lebans site
> http://www.lebans.com/callbackbrowser.htm
> but it required the code to exist in the code behind the form.
> I use this on about 10 forms so would prefer something that I could place in
> just one module.
> 
> Does anyone have a better solution?
> Thanks in advance,
> Mark
> 
> --------------------------------
> Option Compare Database
> Option Explicit
> 
> 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
> Private Const BIF_NEWDIALOGSTYLE = &H40
> 
> Public Function BrowseFolder(szDialogTitle As String) As String
>   Dim X As Long, bi As BROWSEINFO, dwIList As Long
>   Dim szPath As String, wPos As Integer
> 
>     With bi
>         .hOwner = hWndAccessApp
>         .lpszTitle = szDialogTitle
>         .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>     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 = vbNullString
>     End If
> End Function
> ----------------------------------------
>  
> 
> .
> 
0
Utf
5/16/2010 7:35:01 AM
On 14/05/2010 23:43, Mark Andrews wrote:
> I am using this code to browse for a folder (just folders no files) in
> Access 2007.

Save your time!!!

If working in Office 2002 (XP) or newer, there is the FileDialog object.

INFO: The Microsoft Office XP FileDialog Object
http://support.microsoft.com/kb/288543

-- 
Adrian C
0
Adrian
5/16/2010 12:46:20 PM
Thanks but I don't want the reference in the mix.  I thought the filedialog 
was more similar to the common dialog to browse for files?

This is a folder ONLY search (no files are shown).

Mark


"Adrian C" <email@here.invalid> wrote in message 
news:85a7p5FiavU2@mid.individual.net...
> On 14/05/2010 23:43, Mark Andrews wrote:
>> I am using this code to browse for a folder (just folders no files) in
>> Access 2007.
>
> Save your time!!!
>
> If working in Office 2002 (XP) or newer, there is the FileDialog object.
>
> INFO: The Microsoft Office XP FileDialog Object
> http://support.microsoft.com/kb/288543
>
> -- 
> Adrian C 

0
Mark
5/16/2010 11:33:12 PM
Yea I needed the Make New Folder, but I did start with the exact article you 
mentioned.

Mark

"Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
news:ezGFMEE9KHA.420@TK2MSFTNGP02.phx.gbl...
> You added a bit:
>
> Private Const BIF_NEWDIALOGSTYLE = &H40
> and
> .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
> -- 
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
>
>
> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:%234gA%23jC9KHA.5848@TK2MSFTNGP06.phx.gbl...
>> Thanks, however that's what I am using right now.
>> Mark
>
>> "Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
>> news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
>>> Try this, which is where the original code that Stephen used came from:
>>>
>>> http://www.mvps.org/access/api/api0002.htm
>>> -- 
>>> Arvin Meyer, MCP, MVP
>>> http://www.datastrat.com
>>> http://www.accessmvp.com
>>> http://www.mvps.org/access
>>>
>>>
>>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>>>I am using this code to browse for a folder (just folders no files) in
>>>> Access 2007.
>>>> It works great, I just want one extra feature:
>>>> - to supply a starting folder
>>>>
>>>> I found one example on stephen lebans site
>>>> http://www.lebans.com/callbackbrowser.htm
>>>> but it required the code to exist in the code behind the form.
>>>> I use this on about 10 forms so would prefer something that I could 
>>>> place in
>>>> just one module.
>>>>
>>>> Does anyone have a better solution?
>>>> Thanks in advance,
>>>> Mark
>>>>
>>>> --------------------------------
>>>> Option Compare Database
>>>> Option Explicit
>>>>
>>>> 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
>>>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>>>
>>>> Public Function BrowseFolder(szDialogTitle As String) As String
>>>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>>>  Dim szPath As String, wPos As Integer
>>>>
>>>>    With bi
>>>>        .hOwner = hWndAccessApp
>>>>        .lpszTitle = szDialogTitle
>>>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>>>    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 = vbNullString
>>>>    End If
>>>> End Function
>>>> ----------------------------------------
>>>>
>>>>
>>>
>>>
>
> 
0
Mark
5/16/2010 11:33:59 PM
Stuart,

Thanks I will give this a try on Monday.

Appreciate the extra effort!
Mark

"Stuart McCall" <smccall@myunrealbox.com> wrote in message 
news:uVC5mUE9KHA.5464@TK2MSFTNGP05.phx.gbl...
> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:%234gA%23jC9KHA.5848@TK2MSFTNGP06.phx.gbl...
>> Thanks, however that's what I am using right now.
>> Mark
>>
>> "Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
>> news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
>>> Try this, which is where the original code that Stephen used came from:
>>>
>>> http://www.mvps.org/access/api/api0002.htm
>>> -- 
>>> Arvin Meyer, MCP, MVP
>>> http://www.datastrat.com
>>> http://www.accessmvp.com
>>> http://www.mvps.org/access
>>>
>>>
>>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>>>I am using this code to browse for a folder (just folders no files) in
>>>> Access 2007.
>>>> It works great, I just want one extra feature:
>>>> - to supply a starting folder
>>>>
>>>> I found one example on stephen lebans site
>>>> http://www.lebans.com/callbackbrowser.htm
>>>> but it required the code to exist in the code behind the form.
>>>> I use this on about 10 forms so would prefer something that I could 
>>>> place in
>>>> just one module.
>>>>
>>>> Does anyone have a better solution?
>>>> Thanks in advance,
>>>> Mark
>>>>
>>>> --------------------------------
>>>> Option Compare Database
>>>> Option Explicit
>>>>
>>>> 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
>>>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>>>
>>>> Public Function BrowseFolder(szDialogTitle As String) As String
>>>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>>>  Dim szPath As String, wPos As Integer
>>>>
>>>>    With bi
>>>>        .hOwner = hWndAccessApp
>>>>        .lpszTitle = szDialogTitle
>>>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>>>    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 = vbNullString
>>>>    End If
>>>> End Function
>>>> ----------------------------------------
>
> Hi Mark
>
> Unfortunately the browse folder dialog code wasn't written with VBA in 
> mind. You have to use a callback function in order to get the dialog to 
> display the initial folder selection. If anything causes VBA to go into 
> break mode while this is executing, Access will probably crash. That said, 
> here is the code you need. Create a class module (call it clsBrowseFolder) 
> and paste in the following:
>
> ''' Start Code '''
> Option Compare Database
> Option Explicit
> '
> 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 SHGetPathFromIDListA Lib "shell32.dll" _
>    (ByVal pidl As Long, ByVal pszPath As String) As Long
> Private Declare Function SHBrowseForFolderA Lib "shell32.dll" _
>    (lpBrowseInfo As BROWSEINFO) As Long
> Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)
> Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
>    (pDest As Any, pSource As Any, ByVal dwLength As Long)
>
> Private Declare Function LocalAlloc Lib "kernel32" _
>    (ByVal uFlags As Long, ByVal uBytes As Long) As Long
> Private Declare Function LocalFree Lib "kernel32" _
>    (ByVal hMem As Long) As Long
> Private Const LPTR = (&H0 Or &H40)
> '
> Private m_Caption As String
> Private m_InitDir As String
> Private m_ReturnDir As String
> Private m_UserCancel As Boolean
> Private m_hWndOwner As Long
> Private m_ErrOption As Long
>
> Public Property Get Caption() As String
>    Caption = m_Caption
> End Property
> Public Property Let Caption(NewData As String)
>    If Len(NewData) > 50 Then
>        Err.Raise vbObjectError + 1, _
>            "clsFolderDialog.Caption", _
>            "Caption too long. 50 chars max."
>    End If
>    m_Caption = NewData
> End Property
>
> Public Property Let InitDir(NewData As String)
>    m_InitDir = NewData
> End Property
>
> Public Property Get ReturnDir() As String
>    ReturnDir = m_ReturnDir
> End Property
>
> Public Property Get UserCancel() As Boolean
>    UserCancel = m_UserCancel
> End Property
>
> Public Property Let hWndOwner(NewData As Long)
>    m_hWndOwner = NewData
> End Property
>
> Public Sub Execute()
>    Dim bi As BROWSEINFO
>    Dim Buffer As String
>    Dim PathPtr As Long
>    Dim itemID As Long
>    '
>    With bi
>        .hOwner = m_hWndOwner
>        .ulFlags = 1
>        .lpszTitle = m_Caption
>        .lpfn = FuncPtr(AddressOf BrowseFolderHookProc)
>        PathPtr = LocalAlloc(LPTR, Len(m_InitDir) + 1)
>        CopyMemory ByVal PathPtr, ByVal m_InitDir, Len(m_InitDir) + 1
>        .lParam = PathPtr
>    End With
>    Buffer = Space$(512)
>    itemID = SHBrowseForFolderA(bi)
>    If SHGetPathFromIDListA(itemID, Buffer) Then
>        m_ReturnDir = Left(Buffer, InStr(Buffer, vbNullChar) - 1)
>    Else
>        m_UserCancel = True
>    End If
>    CoTaskMemFree itemID
>    LocalFree PathPtr
> End Sub
>
> Private Sub Class_Initialize()
>    m_Caption = "Please Select Folder"
>    With Application
>        m_hWndOwner = .hWndAccessApp
>        m_ErrOption = .GetOption("Error Trapping")
>        .SetOption "Error Trapping", 2
>    End With
> End Sub
>
> Private Sub Class_Terminate()
>    On Error Resume Next
>    Application.SetOption "Error Trapping", m_ErrOption
> End Sub
>
> Private Function FuncPtr(pFunc As Long) As Long
>    FuncPtr = pFunc
> End Function
> ''' End Code '''
>
> Then create a standard module (call it modBrowseFolder) and paste in the 
> following:
>
> ''' Start Code '''
> Option Compare Database
> Option Explicit
> '
> Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
>    (ByVal hWnd As Long, ByVal wMsg As Long, _
>    ByVal wParam As Long, lParam As Any) As Long
> '
> Private Const WM_USER = &H400
> Private Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
> Private Const BFFM_SETSELECTIONW As Long = (WM_USER + 103)
>
> Public Function BrowseFolderHookProc(ByVal hWnd As Long, ByVal uMsg As 
> Long, _
>    ByVal lParam As Long, ByVal lpData As Long) As Long
>    If uMsg = 1 Then
>        Call SendMessage(hWnd, BFFM_SETSELECTIONA, True, ByVal lpData)
>    End If
> End Function
> ''' End Code '''
>
> A simple test:
>
> With New clsBrowseFolder
>    .hwndOwner = Application.hWndAccessApp
>    .InitDir = "c:\temp"
>    .Execute
>    If Not .UserCancel Then
>        MsgBox "Selected Folder: " & .ReturnDir
>    End If
> End With
>
> Hope that helps.
>
> 
0
Mark
5/16/2010 11:35:42 PM
Stuart,

This code works great!  I did change the ulFlags (just to get the "make new 
folder" button):
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const BIF_NEWDIALOGSTYLE = &H40

        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
'old way        .ulFlags = 1

Thanks for this great help (A+),
Mark

"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:edONBCV9KHA.3592@TK2MSFTNGP05.phx.gbl...
> Stuart,
>
> Thanks I will give this a try on Monday.
>
> Appreciate the extra effort!
> Mark
>
> "Stuart McCall" <smccall@myunrealbox.com> wrote in message 
> news:uVC5mUE9KHA.5464@TK2MSFTNGP05.phx.gbl...
>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>> news:%234gA%23jC9KHA.5848@TK2MSFTNGP06.phx.gbl...
>>> Thanks, however that's what I am using right now.
>>> Mark
>>>
>>> "Arvin Meyer [MVP]" <arvinm@mvps.invalid> wrote in message 
>>> news:#kc3Wx78KHA.420@TK2MSFTNGP02.phx.gbl...
>>>> Try this, which is where the original code that Stephen used came from:
>>>>
>>>> http://www.mvps.org/access/api/api0002.htm
>>>> -- 
>>>> Arvin Meyer, MCP, MVP
>>>> http://www.datastrat.com
>>>> http://www.accessmvp.com
>>>> http://www.mvps.org/access
>>>>
>>>>
>>>> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
>>>> news:u5tQVb78KHA.3880@TK2MSFTNGP04.phx.gbl...
>>>>>I am using this code to browse for a folder (just folders no files) in
>>>>> Access 2007.
>>>>> It works great, I just want one extra feature:
>>>>> - to supply a starting folder
>>>>>
>>>>> I found one example on stephen lebans site
>>>>> http://www.lebans.com/callbackbrowser.htm
>>>>> but it required the code to exist in the code behind the form.
>>>>> I use this on about 10 forms so would prefer something that I could 
>>>>> place in
>>>>> just one module.
>>>>>
>>>>> Does anyone have a better solution?
>>>>> Thanks in advance,
>>>>> Mark
>>>>>
>>>>> --------------------------------
>>>>> Option Compare Database
>>>>> Option Explicit
>>>>>
>>>>> 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
>>>>> Private Const BIF_NEWDIALOGSTYLE = &H40
>>>>>
>>>>> Public Function BrowseFolder(szDialogTitle As String) As String
>>>>>  Dim X As Long, bi As BROWSEINFO, dwIList As Long
>>>>>  Dim szPath As String, wPos As Integer
>>>>>
>>>>>    With bi
>>>>>        .hOwner = hWndAccessApp
>>>>>        .lpszTitle = szDialogTitle
>>>>>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
>>>>>    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 = vbNullString
>>>>>    End If
>>>>> End Function
>>>>> ----------------------------------------
>>
>> Hi Mark
>>
>> Unfortunately the browse folder dialog code wasn't written with VBA in 
>> mind. You have to use a callback function in order to get the dialog to 
>> display the initial folder selection. If anything causes VBA to go into 
>> break mode while this is executing, Access will probably crash. That 
>> said, here is the code you need. Create a class module (call it 
>> clsBrowseFolder) and paste in the following:
>>
>> ''' Start Code '''
>> Option Compare Database
>> Option Explicit
>> '
>> 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 SHGetPathFromIDListA Lib "shell32.dll" _
>>    (ByVal pidl As Long, ByVal pszPath As String) As Long
>> Private Declare Function SHBrowseForFolderA Lib "shell32.dll" _
>>    (lpBrowseInfo As BROWSEINFO) As Long
>> Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long)
>> Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
>>    (pDest As Any, pSource As Any, ByVal dwLength As Long)
>>
>> Private Declare Function LocalAlloc Lib "kernel32" _
>>    (ByVal uFlags As Long, ByVal uBytes As Long) As Long
>> Private Declare Function LocalFree Lib "kernel32" _
>>    (ByVal hMem As Long) As Long
>> Private Const LPTR = (&H0 Or &H40)
>> '
>> Private m_Caption As String
>> Private m_InitDir As String
>> Private m_ReturnDir As String
>> Private m_UserCancel As Boolean
>> Private m_hWndOwner As Long
>> Private m_ErrOption As Long
>>
>> Public Property Get Caption() As String
>>    Caption = m_Caption
>> End Property
>> Public Property Let Caption(NewData As String)
>>    If Len(NewData) > 50 Then
>>        Err.Raise vbObjectError + 1, _
>>            "clsFolderDialog.Caption", _
>>            "Caption too long. 50 chars max."
>>    End If
>>    m_Caption = NewData
>> End Property
>>
>> Public Property Let InitDir(NewData As String)
>>    m_InitDir = NewData
>> End Property
>>
>> Public Property Get ReturnDir() As String
>>    ReturnDir = m_ReturnDir
>> End Property
>>
>> Public Property Get UserCancel() As Boolean
>>    UserCancel = m_UserCancel
>> End Property
>>
>> Public Property Let hWndOwner(NewData As Long)
>>    m_hWndOwner = NewData
>> End Property
>>
>> Public Sub Execute()
>>    Dim bi As BROWSEINFO
>>    Dim Buffer As String
>>    Dim PathPtr As Long
>>    Dim itemID As Long
>>    '
>>    With bi
>>        .hOwner = m_hWndOwner
>>        .ulFlags = 1
>>        .lpszTitle = m_Caption
>>        .lpfn = FuncPtr(AddressOf BrowseFolderHookProc)
>>        PathPtr = LocalAlloc(LPTR, Len(m_InitDir) + 1)
>>        CopyMemory ByVal PathPtr, ByVal m_InitDir, Len(m_InitDir) + 1
>>        .lParam = PathPtr
>>    End With
>>    Buffer = Space$(512)
>>    itemID = SHBrowseForFolderA(bi)
>>    If SHGetPathFromIDListA(itemID, Buffer) Then
>>        m_ReturnDir = Left(Buffer, InStr(Buffer, vbNullChar) - 1)
>>    Else
>>        m_UserCancel = True
>>    End If
>>    CoTaskMemFree itemID
>>    LocalFree PathPtr
>> End Sub
>>
>> Private Sub Class_Initialize()
>>    m_Caption = "Please Select Folder"
>>    With Application
>>        m_hWndOwner = .hWndAccessApp
>>        m_ErrOption = .GetOption("Error Trapping")
>>        .SetOption "Error Trapping", 2
>>    End With
>> End Sub
>>
>> Private Sub Class_Terminate()
>>    On Error Resume Next
>>    Application.SetOption "Error Trapping", m_ErrOption
>> End Sub
>>
>> Private Function FuncPtr(pFunc As Long) As Long
>>    FuncPtr = pFunc
>> End Function
>> ''' End Code '''
>>
>> Then create a standard module (call it modBrowseFolder) and paste in the 
>> following:
>>
>> ''' Start Code '''
>> Option Compare Database
>> Option Explicit
>> '
>> Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
>>    (ByVal hWnd As Long, ByVal wMsg As Long, _
>>    ByVal wParam As Long, lParam As Any) As Long
>> '
>> Private Const WM_USER = &H400
>> Private Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
>> Private Const BFFM_SETSELECTIONW As Long = (WM_USER + 103)
>>
>> Public Function BrowseFolderHookProc(ByVal hWnd As Long, ByVal uMsg As 
>> Long, _
>>    ByVal lParam As Long, ByVal lpData As Long) As Long
>>    If uMsg = 1 Then
>>        Call SendMessage(hWnd, BFFM_SETSELECTIONA, True, ByVal lpData)
>>    End If
>> End Function
>> ''' End Code '''
>>
>> A simple test:
>>
>> With New clsBrowseFolder
>>    .hwndOwner = Application.hWndAccessApp
>>    .InitDir = "c:\temp"
>>    .Execute
>>    If Not .UserCancel Then
>>        MsgBox "Selected Folder: " & .ReturnDir
>>    End If
>> End With
>>
>> Hope that helps.
>>
>> 
0
Mark
5/18/2010 12:25:26 PM
On 17/05/2010 00:33, Mark Andrews wrote:
> Thanks but I don't want the reference in the mix.

It's Application.FileDialog available in all Office programs.

No additional 'Tools->References' refs need adding as far as I'm aware.

   I thought the
> filedialog was more similar to the common dialog to browse for files?
>
> This is a folder ONLY search (no files are shown).
>

There is the msoFileDialogFolderPicker option for that.

http://msdn.microsoft.com/en-us/library/aa194905%28office.10%29.aspx


-- 
Adrian C
0
Adrian
5/18/2010 3:55:50 PM
I was going to use the code Stuart McCall suggested, but you might be right 
and just using filedialog would be better.

The fileDialog does require a reference to Microsoft Office 12 Object 
Library, but I think I always need that reference anyway
for the ribbon to work.

If anyone can see a problem with this method let me know.

Thanks for your help (I guess I had it in my mind that filedialog should not 
be used over these other API calls),
Mark


"Adrian C" <email@here.invalid> wrote in message 
news:85frkbFptfU1@mid.individual.net...
> On 17/05/2010 00:33, Mark Andrews wrote:
>> Thanks but I don't want the reference in the mix.
>
> It's Application.FileDialog available in all Office programs.
>
> No additional 'Tools->References' refs need adding as far as I'm aware.
>
>   I thought the
>> filedialog was more similar to the common dialog to browse for files?
>>
>> This is a folder ONLY search (no files are shown).
>>
>
> There is the msoFileDialogFolderPicker option for that.
>
> http://msdn.microsoft.com/en-us/library/aa194905%28office.10%29.aspx
>
>
> -- 
> Adrian C 

0
Mark
5/18/2010 8:28:01 PM
"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:Ota4ZWo9KHA.5412@TK2MSFTNGP06.phx.gbl...
> Stuart,
>
> This code works great!  I did change the ulFlags (just to get the "make 
> new folder" button):
> Private Const BIF_RETURNONLYFSDIRS = &H1
> Private Const BIF_NEWDIALOGSTYLE = &H40
>
>        .ulFlags = BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE
> 'old way        .ulFlags = 1
>
> Thanks for this great help (A+),
> Mark

You're welcome (whether you decide to use it or not).

FWIW the reason I've stuck with the api is that I work in both Access and 
vb6, and with a small change (which I removed to avoid confusion) it will 
compile for either.


0
Stuart
5/19/2010 12:26:00 AM
"Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
news:u26pcis9KHA.1888@TK2MSFTNGP05.phx.gbl...
>I was going to use the code Stuart McCall suggested, but you might be right 
>and just using filedialog would be better.
>
> The fileDialog does require a reference to Microsoft Office 12 Object 
> Library, but I think I always need that reference anyway
> for the ribbon to work.

You can use FileDialog without a library reference, declaring everything as 
Object to use late binding.  However, you need to supply your own constants 
for the ones defined in the object library, such as 
msoFileDialogFolderPicker.

-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Dirk
5/19/2010 2:42:43 AM
Thanks for the info.  I did end up using the filedialog and since I needed a 
Microsoft Office 12 Object reference for the ribbon
I just used the normal code and constants.  That's one of those references 
that doesn't cause problems.

Mark



"Dirk Goldgar" <dg@NOdataSPAMgnostics.com.invalid> wrote in message 
news:A50624CC-E5A8-4FED-936C-9020827D6DB9@microsoft.com...
> "Mark Andrews" <mandrews___NOSPAM___@rptsoftware.com> wrote in message 
> news:u26pcis9KHA.1888@TK2MSFTNGP05.phx.gbl...
>>I was going to use the code Stuart McCall suggested, but you might be 
>>right and just using filedialog would be better.
>>
>> The fileDialog does require a reference to Microsoft Office 12 Object 
>> Library, but I think I always need that reference anyway
>> for the ribbon to work.
>
> You can use FileDialog without a library reference, declaring everything 
> as Object to use late binding.  However, you need to supply your own 
> constants for the ones defined in the object library, such as 
> msoFileDialogFolderPicker.
>
> -- 
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
> 
0
Mark
5/19/2010 7:58:55 PM
Reply:

Similar Artilces:

Exch2k Calendar in Public folder post meeting request not available?
I have created a calendar in a public folder, and want it to accept meeting requests through OWA, not the default appointments. When I try to change it via Outlook 2002 it tells me it cannot accept this type? I.e. On the general tab for the folder properties it says "When posting to this folder use, Appointment (I want to use "Meeting Request" from the forms ....) Also when logging into the public folder and creating an appointment, it does not allow me to add attendees? it is grayed out. Any help would be much appreciated. Tim ...

how to let emails get into each folder?
Hi all, I saw my boss has this feature in his outlook 2003: He divides the inbox into "Family", "Work", ... etc. folders, then whenever a new email arrives, they will automatically get into these folders... How to do that? Thanks a lot! Rules. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, networm asked: | Hi all, | | I saw my boss has this feature in his outlook 2003: | | He divides the inbox into &q...

folder access by mail-enabled user
We have a mail-enabled user, one with a credential but an off-site mailbox at their home site. How can this user gain access to the Exchange mailbox Inbox folder of a local user? They can be given permissions, but OWA (2007) does not allow drill down to the user... HankC The user will have to log into that mailbox separately. -- Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." .. "HankC" <clarkc@missouri.edu> wrote in message news:d739ad46-fa2e-43dc-a4b1-04006badddd9@d21g2000yqn.googlegroups.com... >...

Code giving undesired results
Another helpful person here gave me a sample, untested code to try to concatenate List Box Multi-Selections into a sentence. I've tweaked it a bit to attach it to the On Enter event of another control on the same form but am not quite getting the result I need. This result seems to count the # of selections made vs. returning the text of the selections. Here is the code: Dim varRow As Variant For Each varRow In Forms![frmDamage]![lbDamagedParts].ItemsSelected Me.Text36 = "There is damage to " & varRow & ", " Next varRow Me.Text36 = Left(Me.Tex...

Please suggest best coding standard
Hi, Please tell me which version of the function below you find better coding etiquette and why! BOOL Example1(BOOL b) { if( b ) return TRUE; else return FALSE; } BOOL Example2(BOOL b) { if( b ) return TRUE; return FALSE; } I believe Example1 is considered 'neater' though I don't agree. However, is there a technical, compiler optimzing reason or some other good reason to go with Example1 ? And, part of the question if( b ) DoSomething(); else DoSomethingElse(); or if(b) { DoSomething(); } else { DoSomethingElse(); } ...

Outlook 98 Sharing Net Folders
I have setup my calendar sharing by using the netfolders feature that comes with OL 98 and my other computer received the invintation to participate but the originating computer never gets the acceptance of the invitation. This is not just a problem with these two computers but all of them at my work. It seems you setup netfolder and go through the wizard, send an invitation, then accept it, but it never goes beyond that. I meet all the requirements such as a pop email system, internet mail trasnport type with rich test format. What am i missing? Thank you! Christian ...

Move all Public folders from one server to anorther.
What is the best solution to moving all the Public folders from one server to another server ? The servers is NOT in the same doman, organisation or site. I hav TCP/IP connectivitybetween the servers. Jane On Mon, 16 Oct 2006 12:32:29 +0200, dfgdfgd <kdhvjhg@jsfsgsd.com> wrote: >What is the best solution to moving all the Public folders from one >server to another server ? The servers is NOT in the same doman, >organisation or site. I hav TCP/IP connectivitybetween the servers. > > >Jane This will do a replication: http://support.microsoft.com/kb/238573/ after whic...

Public Folders not listed on Folder List
I cannot see Public Folders on my Outlook 2003 SP2 Folder List. I am using Exchange 5.5 SP4. Please help. Have you permission to see each folder? /Lasse "M P" <mark@textguru.ph> wrote in message news:ORUUCoMpGHA.3584@TK2MSFTNGP03.phx.gbl... >I cannot see Public Folders on my Outlook 2003 SP2 Folder List. I am using >Exchange 5.5 SP4. Please help. > Could you see them yesterday? Describe what happened - what changes did you make to the system? .. -- Judy Gleeson Microsoft Most Valuable Professional Outlook www.acorntraining.com.au "Lasse Pette...

Exchange 2003 - SchedulePlusFreeBusy Folder
Hello, I am running exchange 2003 SP1 (new server, no upgrades) and I am recieving the following messaage: Event Type: Error Event Source: MSExchangeFBPublish Event Category: General Event ID: 8275 Date: 8/23/2004 Time: 2:01:07 AM User: N/A Computer: PG-ADR-EXCH-03 Description: SchedulePlusFreeBusy folder could not be opened for duplicate message deletion on virtual machine PG-ADR-EXCH-03. The error number is 0x80040115. I have looked everywhere and cannot find any information. Anyone have any ideas? Thanks, Paul. ...

Not able to acces public folders on outlook 2003
not able to access Public folders on outlook 2003 after installing office 2003 service pack. please let me know how to fix this issues What happens when you try? Did you try making a new profile? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Join OneNote Tips mailing list: http://www.onenote-tips.net/ Vote for your fav...

Outlook 2003 starts up at every logon although not in Startup folder
I am using Outlook 2003 on XP Pro and it automatically starts up whenever I log on to the computer. I want to stop this behaviour, but I don't know how to. I removed it from the Startup folder, but it is still launching every time. Can this option have been configured some other way? Thanks in advance for any assistance. -- Stephen Turner Stephen Turner <sretnews@adelie.freeserve.co.uk> wrote: > I am using Outlook 2003 on XP Pro and it automatically starts up > whenever I log on to the computer. I want to stop this behaviour, but > I don't know how to. Click Start&...

outlook 2k, win xp pro, OLK folder, and users
Hey all. Need some help here. I don't even know if there is a way to do force this. Here is the scenario: User receives email with attachment in outlook User open email User opens attachment (word, excel, whatever) User makes changes to document User clicks on File, chooses Save As Word for example, wants to save the file in hidden directory such as "C:\Documents and Settings\jim bob\Local Settings\Temporary Internet Files\olk1234" User tries to browse for it, can't find it. Now if the user does this: User receives email with attachment in outlook User opens email Use...

Is there any way to hide folders with the "_files" extension?
Not sure what they are or why they are there, but the folders with the "_files" extension really clutter things up and make it difficult to find the files I am looking for. Any way to hide those, or some other method so that I don't have to look at these? They are the files associated with documents saved as web pages. Save your web pages in a separate folder from your Word documents and avoid the clutter. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP ...

How do I do a New Mail Alert on a seperate folder??
I have a rule to divert my important messages to a seperate folder marked Urgent. Problem is, how do I apply a rule to this folder?? Lets say new mail has come in and 2 messages have been sent to Urgent folder.. I need to know right away that this folder has 2 new items.. Can someone please help?? Seems silly to have rules only for Inbox.. Thanks, Ajay I think you've got things mixed up now. All mails are being delivered to the Inbox. With rules you can automatically move them to a different folder. You can also set the action to show the New Message Notification in the rule. -...

Help, I can't find the right code
I was trying to code using If Then based on a post I read but I think I'm using the wrong code. In my form I want if you answer "yes" to variable 1 then variable 2 must be completed however the code I am currently using required variable 2 to be completed regardless if the answer is "yes" or "no" I am new to access and the world of coding please help! Here is the code I am using: If Not IsNull(Me.Injuries_to_Staff) And IsNull(Me.Explain_Injury) Then Cancel = True MsgBox "Explanation of Injury Is Required" Me.Explain_Injury.SetFocus End I...

forgot password of my outlook personal folder. How do i get data
I forgot password of my outlook personal folder. I am unable to open the folder now that I have closed it. How do I retreive the data? "Kannappa" <Kannappa@discussions.microsoft.com> wrote in message news:8283A7D2-4F11-4656-B6F3-570FF99DE9EB@microsoft.com... >I forgot password of my outlook personal folder. I am unable to open the > folder now that I have closed it. How do I retreive the data? Have a look at some of these: http://search.live.com/results.aspx?q=pst+password+cracker&src=IE-SearchBox ...

Outlook 2002
Hi, how do I make Outlook send the HTML code as HTML bodypart. I paste the HTML code into the mail from a HTML document. Thanks in advance for any answers! Cheers, Trygve See http://www.slipstick.com/mail1/html.htm for varioius methods.=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Trygve Lorentzen" <trygveloAThaldenDOTnet> wrote in message = news:emrqkyYRFHA.904@tk2msftngp13.phx.gbl... > Hi, >=20 > how do I make O...

Create a new image Complete from VBA code
I have a form I'd like to simulate a very basic animation based on underlying data. (I use the term 'animation' losely). Basically, I want to be able to move an image around the form, change the width/height/coordinates depending on what the data values are underneath. I can do this if I have the initial image no problem, however I run into trouble if I want to create another image based off that original tempalte. Is there a way in VB code to completely copy an existing Image object on the form, basicaly cloning it, so I can move around both copies of the image independently? ...

Public folder cannot reply w/template- rule changes unsaved
Hello, We have a public folder which is mail enabled- we want all posts going to that public folder to reply with an auto response. I've elected that the only option would be to set-up a rule under the Public folder properties- there is a tab that has Folder Management. You can then setup a rule and reply with template. It will let me add the rule until I get to the very-end and then when trying to select OK - I recieve the message "Changes to the rule could not be saved" I have tried saving my template as rich text, oft (Template design) and text- but to no avail- It ...

Windows Update Error Code 80010108
Hi all, I have been trying to update my computer (Windows 7 64 bit) and its been two days since I've been trying to update and it just does not update! I get the error code 80010108 and I have no idea whats going on. If anyone has any clue or if anyone is experiencing this as well please let me know! Thanks for your help! A Google search on 80010108 resulted in pages of things to check. "JoJo" <JoJo@discussions.microsoft.com> wrote in message news:9DE0AA5F-2C7E-4789-A119-34070F83F836@microsoft.com... > Hi all, I have been trying to update my computer (...

Opening Other User's Folders
How do you as admin open other user's Inbox, Calendar, etc? I would like to do it 1 of 2 ways, Using FILE, OPEN, OTHER USERS FOLDER and by adding the additional mailbox to my profile. I have already assigned myself admin permissions at the Enterprise, Site and Configuration level. Thanks You need Service Account Admin permissions at the site level. -Peter "Scott" <scottcukier@hotmail.com> wrote in message news:37e501c42985$1cf56550$a401280a@phx.gbl... > How do you as admin open other user's Inbox, Calendar, > etc? > > I would like to do it 1 of ...

Personal Folders #3
A couple of years ago, I mistakenly added a second copy of Outlook to my system. This created a second set of personal folders. Outlook will not let me erase them, nor has uninstalling all of the Office suite helped. When I reopen Outlook the extra set of folders is still there. I have deleted the .pst files and Outlook keeps re-creating them. Now I have a new PDA and it will not establish conduits to syncronize with Outlook because it sees the false sets of .pst folders and determines that there are no other .pst's. Is this a registry problem? How can I rid myself of the ...

upgrading VBA code
Hello: I just conducted an upgrade from 7.5 to 9.0 including upgrading reports and forms dictionaries. Everything went fine. But, even though the server's Customization Maintenance window is showing "Form with VBA" and even ADO form types, I do not see the code in VBA Editor nor do some of the customized windows work. And, on the Terminal Services "workstation" which uses a separate set of dictionaries altogether, I do not see anything in Customization Maintenance listing VBA code. In the old 7.5 folder, I see vba files. I know that it is not as simple as t...

how to color code a row of cells based on a specific cell value
Hi check out conditional formatting - Debra Dalgleish has some good notes on her website. http://www.contextures.com/xlCondFormat01.html Cheers julieD "Parker1333" <Parker1333@discussions.microsoft.com> wrote in message news:79A73741-CBDB-4F49-B690-88C8F23FB362@microsoft.com... > ...

Integration Manager: Map the account codes according the positive or negative amount
Integration Mapping to create a batch with transaction entries to "General Journal". Source data contains a list of records with fields like: Batch ID (hardcoded), Transaction Date, Account Codes, Amounts (some are positive some are negative value), May I know how to configure the Integration Manager, so that whenever: The Amount field is negative value, then a hardcoded account code will be used for the Integration. Source data1 : Batch01, 20/1/2010 Source data2 : 100-2000-000, 300.88 100-2000-000, -600.60 100-2000-000, 930.12 100-2000-000, -200...