Common Dialog – folder selection?

Common Dialog – folder selection?

In Word 7.0, under Tools, Options, File Locations tab, there is a dialog that comes up to define the folder containing certain types of files. This dialog allows folder selection only, not file selection. Is this acessible through VB somehow? Is it a common dialog that I can get to?If not, is there a simple method to create this type of dialog?

The standard Common Dialog is unable to create this dialog. However, anAPI call to the shell is able to do it. Add the code to your project, andthen call the routine like so:

Dim sPath as StringsPath = fnBrowseForFolder(Me.hWnd, “Select Output Directory”)
Me refers to a form, so you can specify a particular form if you wish. Thedialog will approximately center itself within the borders of the form, soyou may want to pick your MDI frame if you are using one.
Option ExplicitPrivate Type BrowseInfo    hWndOwner      As Long    pIDLRoot       As Long    pszDisplayName As Long    lpszTitle      As Long    ulFlags        As Long    lpfnCallback   As Long    lParam         As Long    iImage         As LongEnd TypePrivate Const BIF_RETURNONLYFSDIRS = 1Private Const MAX_PATH = 260Private Declare Function lstrcat Lib “kernel32” Alias “lstrcatA” _       (ByVal lpString1 As String, ByVal lpString2 As String) As LongPrivate Declare Function SHBrowseForFolder Lib “shell32” _       (lpbi As BrowseInfo) As LongPrivate Declare Function SHGetPathFromIDList Lib “shell32″ _       (ByVal pidList As Long, ByVal lpBuffer As String) As Long” fnBrowseForFolder” This function will create the directory browser’ window common to other applications.’Public Function fnBrowseForFolder(hWndOwner As Long, sPrompt As String) AsString   Dim iNull As Integer   Dim lpIDList As Long   Dim lResult As Long   Dim sPath As String   Dim udtBI As BrowseInfo   Dim iPos As Integer      With udtBI       .hWndOwner = hWndOwner       .lpszTitle = lstrcat(sPrompt, “”)       .ulFlags = BIF_RETURNONLYFSDIRS   End With   lpIDList = SHBrowseForFolder(udtBI)   sPath = Space$(512)   If lpIDList Then      lResult = SHGetPathFromIDList(lpIDList, sPath)      If lResult Then         iPos = InStr(sPath, Chr$(0))         sPath = Left$(sPath, iPos)      Else         sPath = “”      End If   End If   fnBrowseForFolder = sPathEnd Function

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes