Case 2
.Filters.Add “Paradox files”, “*.db”
Case 3
.Filters.Add “Lotus 1-2-3 files”, “*.wk3”
End Select
.InitialView = msoFileDialogViewDetails
.InitialFileName = strPath
If .Show = -1 Then
strAppFile = CStr(fd.SelectedItems.Item(1))
Else
Debug.Print “User pressed Cancel”
End If
End With
txt.Value = strAppFile
Save the value to tblInfo.
SaveAppFile (strAppFile)
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End Sub
The “Import File Type” option group’s After_Updateprocedure first checks that the selected
application file is the right type, and clears it if not, then sets up a Select Casestatement to
process the three types of application files differently, calling the SaveTextFileSub:
Private Sub fraFileType_AfterUpdate()
On Error GoTo ErrorHandler
Dim strExt As String
Check that selected application file is the right type, and clear the file selection if not.
intFileType = Nz(Me![fraFileType].Value, 1)
If Len(GetTextFile()) > 4 Then
strExt = Right(strAppFile, 3)
End If
Part II Writing VBA Code to Exchange Data between Office Components