|
-
Sep 27th, 2000, 10:22 AM
#1
Thread Starter
Addicted Member
Hi, HeSaidJoe,
Thanks for your attention.
I am a ¡°senior (in age)¡± beginner. I began to teach myself VB6 last year and now I¡¯m trying to make a program to test computer learners for their computer competency. The program consists of five types of tests: Multiple Choice, True or False, General Windows Operation, and Application of Microsoft Office and Paintbrush. I have come across two problems I feel difficult to solve. One is how to call an external application (Winword or Pbrush, for example) to open a document in the installed directory. The other is how to find a record (with DAO 3.51) with a variant field which is not null. As for the first problem, part of my source code is listed as follows (Problem crops up with the "Shell" line):
Case 4
With rstCreation
.FindFirst ("Bianhao = " & intBianhao)
If .NoMatch Then
MsgBox "Error accessing the Library" , vbOKOnly + vbInformation, "Error found"
Exit Function
End If
Load ProbCrt
ProbCrt.Label1.Caption = .Fields("Timu")
bytLxing = .Fields("Leixing")
Me.Hide
Select Case bytLxing
Case 2
If Len(rstExaminee!Beizhu) > 0 Then
strTgtFile = Trim(rstExaminee!Beizhu)
Else
strSrcFile = App.Path & "\Library\XmWord.Ncd"
If Dir(strSrcFile) = "" Then
MsgBox "Error accessing the Library", vbOKOnly + vbInformation, "Error found"
Unload ProbCrt
Me.Show 1
Exit Function
End If
strTgtFile = GetFiName(".Doc")
Ciperist strSrcFile, strTgtFile
End If
ProbCrt.Show
Shell strWordDir & "\Winword.exe " & strTgtFile, vbMaximizedFocus
Private Function GetFiName(ByVal FileExt As String) As String
'
'--------------------------------------------------------------
' Function to get a file name for the examinee to open a file to
¡® work with Office or Pbrush
'--------------------------------------------------------------
Dim strTmpName As String
strTmpName = App.Path & "\" & strExamineeName
If Dir(strTmpName & FileExt) = "" Then
GetFiName = strTmpName & FileExt
ElseIf Dir(strTmpName & "A" & FileExt) = "" Then
GetFiName = strTmpName & "A" & FileExt
ElseIf Dir(strTmpName & "B" & FileExt) = "" Then
GetFiName = strTmpName & "B" & FileExt
ElseIf Dir(strTmpName & "C" & FileExt) = "" Then
GetFiName = strTmpName & "C" & FileExt
ElseIf Dir(strTmpName & "D" & FileExt) = "" Then
GetFiName = strTmpName & "D" & FileExt
ElseIf Dir(strTmpName & "E" & FileExt) = "" Then
GetFiName = strTmpName & "E" & FileExt
ElseIf Dir(strTmpName & "F" & FileExt) = "" Then
GetFiName = strTmpName & "F" & FileExt
ElseIf Dir(strTmpName & "G" & FileExt) = "" Then
GetFiName = strTmpName & "G" & FileExt
ElseIf Dir(strTmpName & "H" & FileExt) = "" Then
GetFiName = strTmpName & "H" & FileExt
ElseIf Dir(strTmpName & "I" & FileExt) = "" Then
GetFiName = strTmpName & "I" & FileExt
ElseIf Dir(strTmpName & "J" & FileExt) = "" Then
GetFiName = strTmpName & "J" & FileExt
ElseIf Dir(strTmpName & "K" & FileExt) = "" Then
GetFiName = strTmpName & "K" & FileExt
ElseIf Dir(strTmpName & "L" & FileExt) = "" Then
GetFiName = strTmpName & "L" & FileExt
Else
MsgBox "Too many files have been opened, Click OK to quit¡±, vbOKOnly + vbExclamation, "Error in creating files"
EndExam True ¡®function to close system
End If
End Function
IHailJoe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|