I have the following code:
Private Sub Command0_Click()
Dim strDirPath As String
Dim strOutDocName As String
Dim strDir As String
Dim strDirEntry As String
' strDirPath is a Function that Gets the path to the Microsoft Word Directory
strDirPath = DirToPath("word\", False)
strDir = strDirPath & "*.doc"
strDirEntry = Dir(strDir)
Do While strDirEntry <> ""
MsgBox strDirEntry
strDirEntry = Dir
Loop
End Sub
When I click on a button in my form , the code above runs and message boxes
pop up printing out each document in the Word directory. I would like to
populate the choices in a combo box on the form with each of these documents,
so I can click on the document thayt I want to print.
How can I populate the combo box with the list of documents instead of
displaying them with the Msgbox command?
Thanks
Mark
Damon Heron - 25 May 2008 20:31 GMT
check out help for combobox.additems....
Here is a function to add items to a combobox set to value list:
Function AddItemToBeginning(ctrlComboBox As ComboBox, _
ByVal strItem As String)
ctrlComboBox.AddItem Item:=strItem, Index:=0
End FunctionDamon
>I have the following code:
>
[quoted text clipped - 32 lines]
> Thanks
> Mark