Here is an example code in this question . Citation:
In VB6 add the component:
- Project> Components
- On the Management tab, select Microsoft Common Dialog Control 6.0 (SP6)
Now in your form add a new Common Dialog control from the toolbar
In the code you need:
CommonDialog1.Filter = "Apps (*.txt)|*.txt|All files (*.*)|*.*"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen
'The FileName property gives you the variable you need to use
MsgBox CommonDialog1.FileName
source
share