this is starting to drive me crazy, VBA doesnt seem to like the .filter.add line code i have and i ant figure out why.
Dim dlgOpen As FileDialog
Dim strFileName As String
Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)
With dlgOpen
.InitialFileName = "C:\"
.Title = "Import Scanned Image"
.Filters.Add "Text Files (*.txt)", "*.TXT;*.RTF "
.Filters.Add "Pictures (*.jpg)", "*.JPG;*.JPEG;*.bmp"
End With
dlgOpen.Show
If dlgOpen.SelectedItems.count > 0 Then 'If an item has been selected then do something with it
strFileName = dlgOpen.SelectedItems(1) 'Save the selected item in variable
End If
txtPathName.SetFocus
txtPathName.Text = strFileName
Dim dlgOpen As FileDialog
Dim strFileName As String
Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)
With dlgOpen
.InitialFileName = "C:\"
.Title = "Import Scanned Image"
.Filters.Add "Text Files (*.txt)", "*.TXT;*.RTF "
.Filters.Add "Pictures (*.jpg)", "*.JPG;*.JPEG;*.bmp"
End With
dlgOpen.Show
If dlgOpen.SelectedItems.count > 0 Then 'If an item has been selected then do something with it
strFileName = dlgOpen.SelectedItems(1) 'Save the selected item in variable
End If
txtPathName.SetFocus
txtPathName.Text = strFileName