Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need DriveListBox, DirListBox & FileListBox in Word VBA 1

Status
Not open for further replies.

eman6

Programmer
Dec 7, 2004
578
CH
The title said it all already.
Is there a way to have a DriveListBox, DirListBox & FileListBox in Word VBA?
I need to put them in a form to allow users to select certain items to insert in Word, within a composition.
For some strange reason, these are not available in the list of references (usually within common controls).

_______________________________________

Eman_2005
Technical Communicator
 
Hi eman2005,

Are the in-built dialogue boxes not sufficient? Check out the dialogs property in Word's vba help file. If not, you could used something based on code like the following to browse for a drive/folder combination.

Sub Test()
MsgBox GetFolder(Title:="Find a Folder", RootFolder:=&H11)
End Sub

Function GetFolder(Optional Title As String, Optional RootFolder As Variant) As String
On Error Resume Next
GetFolder = CreateObject("Shell.Application").BrowseForFolder(0, Title, 0, RootFolder).Items.Item.Path
End Function

You might also want to check out the FileSearch Object.

Cheers
 
Duh!!
Of course, I could use the built-in FileDialog.
Sorry, for some reason I totally forgot about that.
I've used it in the past myself.

Thanks for the reminder and the other option too :)


_______________________________________

Eman_2005
Technical Communicator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top