This worked for me just now:
VB Code:
Private Sub cmdOpen_Click() ' CancelError is True. On Error GoTo ErrHandler CommonDialog1.InitDir = "\\w2k\c550" ' this is the network drive ' Set Flags CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNLongNames ' Set filters. CommonDialog1.Filter = "All Files (*.*)|*.*|Text" & _ "Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat" ' Specify default filter. CommonDialog1.FilterIndex = 2 ' Default to TEXT ' Display the Open dialog box. CommonDialog1.ShowOpen ' Call the open file procedure. ' OpenFile (CommonDialog1.FileName) Debug.Print CommonDialog1.FileName Exit Sub ErrHandler: ' User pressed Cancel button. Exit Sub End Sub




Reply With Quote