Browse Dialog Box

Status
Not open for further replies.
B

Brad

Thanks for taking the time to ready my question.

I have a sub that helps me save an e-mail message to a folder on my

computer. What I have to do at the moment is type the full path into an

InputBox. What I'd like to do is have a dialog box pop up that has a browse

button on it. I can do this in MS Access, and copied my code over, but it

doesn't work in Outlook.

Does anyone know where I might find this type of code so I can use it in

Outlook?

Here is what I use in Access:

Option Compare Database

Option Explicit

'************** Code Start **************

'This code was originally written by Terry Kreft.

'It is not to be altered or distributed,

'except as part of an application.

'You are free to use it in any application,

'provided the copyright notice is left unchanged.

'

'Code courtesy of

'Terry Kreft

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, bi As BROWSEINFO, dwIList As Long

Dim szPath As String, 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 = vbNullString

End If

End Function

'*********** Code End *****************
 
K

Ken Slovak - [MVP - Outlook]

Other than the Option Compare Database that should work as well in Outlook

VBA as it does in Access VBA. What problems are you having with it?

"Brad" <Brad> wrote in message

news:7B3998A8-4A5C-4505-B896-A4966C490B29@microsoft.com...
> Thanks for taking the time to ready my question.

> I have a sub that helps me save an e-mail message to a folder on my
> computer. What I have to do at the moment is type the full path into an
> InputBox. What I'd like to do is have a dialog box pop up that has a
> browse
> button on it. I can do this in MS Access, and copied my code over, but it
> doesn't work in Outlook.

> Does anyone know where I might find this type of code so I can use it in
> Outlook?

> Here is what I use in Access:

> Option Compare Database
> Option Explicit

> '************** Code Start **************
> 'This code was originally written by Terry Kreft.
> 'It is not to be altered or distributed,
> 'except as part of an application.
> 'You are free to use it in any application,
> 'provided the copyright notice is left unchanged.
> '
> 'Code courtesy of
> 'Terry Kreft

> 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, bi As BROWSEINFO, dwIList As Long
> Dim szPath As String, 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 = vbNullString
> End If
> End Function
> '*********** Code End *****************
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
T Unable to 'Upload a file' using popup 'Browse' button Using Outlook 0
U Disable "Always ask before opening" Dialog Using Outlook 3
D.Moore PickFolder dialog "extension" Outlook VBA and Custom Forms 0
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
P IMAP Folders Dialog Box Using Outlook 1
P Suppress dialog box on email check error? Using Outlook 5
S Reminder Dialog Open Button Using Outlook 2
Laurent Duchastel New email setup dialog doesn't allow alias Using Outlook 2
M Dialog called up multiple times when saving emails from macro Outlook VBA and Custom Forms 2
Diane Poremsky Enter Network Password Dialog Keeps Popping Up Using Outlook 0
Diane Poremsky Rules & Alerts Dialog Won't Open Using Outlook 1
moron save as & file location dialog box popup Outlook VBA and Custom Forms 2
N Outlook dialog about retention policy Using Outlook 3
P VBA for Dialog Box when sending Email Using Outlook 8
R Need code to gather value of custom field on addressentry.details dialog box Using Outlook 3
D Contacts as default in Select Names dialog Using Outlook 1
R how do I eliminate allow access dialog box using VBAproject in Out Outlook VBA and Custom Forms 1
J Select Names Dialog Box Outlook VBA and Custom Forms 16
P Open Advanced Search Dialog Outlook VBA and Custom Forms 1
A outlook AdvanceFind dialog Outlook VBA and Custom Forms 5
S how to add my custom items to "Change E-mail Account" dialog Outlook VBA and Custom Forms 1
J Save As dialog box on screen Outlook VBA and Custom Forms 1
H How turn off outlook security warning dialog box from outlook Outlook VBA and Custom Forms 1
R (Outlook2003)Monitor change for "to" "cc" "bcc" on message compose dialog? Outlook VBA and Custom Forms 6
P How to Open File Selector dialog in VBA Outlook VBA and Custom Forms 4
M Outlook2007 and VSTO, handle the Click on the Save Button in the IPM.Note dialog HOWTO? Outlook VBA and Custom Forms 4
J common dialog Outlook VBA and Custom Forms 1
B how/what dialog boxes can I display from VBA code Outlook VBA and Custom Forms 1
J How do you disable address search box when typing @ in body of email? Using Outlook 0
L Is there a way to completely disable the "archive" box? Using Outlook 1
M Reverting The Outlook Search Box Location (or other undesired additions) Using Outlook 1
P outlook 2008 search box criteria couldn't be saved Using Outlook 2
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 5
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
N Private check box in table view Using Outlook 0
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
J Program Checkbox that will activate a text box in a Outlook fallible form. Outlook VBA and Custom Forms 1
CWM030 Call me old if you want. OL 2016 font size out of the box. Using Outlook 3
E Don't want Inbox shown when login box is shown Using Outlook 1
stephen li VBA Outlook send mail automatically by specified outlook mail box Outlook VBA and Custom Forms 1
G Using Data From Combo Box in Appointment Body Outlook VBA and Custom Forms 6
A GetSelectNamesDialog Pre-fill search box Outlook VBA and Custom Forms 12
P Custom Outlook form_Validations in combo box Outlook VBA and Custom Forms 0
P Outlook 2010 sending safe senders email to junk box Using Outlook 8
K Sharedmail box Outlook VBA and Custom Forms 4
Diane Poremsky Outlook Suggestion Box at Uservoice Using Outlook 0
D Emails do not appear in Sent box! Using Outlook 4
T OL2010 Password box keeps appearing. Using Outlook 6
A From box in custom outlook Form Outlook VBA and Custom Forms 0
Kristine RS box added in Favorites disappears Using Outlook 6

Similar threads

Top