|
-
Jan 26th, 2002, 01:01 AM
#1
Thread Starter
PowerPoster
Help with this code, again
I got some people to help me with this code last time as the first time I did it, it was a real mess. Then I got some guys to help me sort it out, and they gave me something like this.
Theres a problem with the Select Case bit.
Anyway...
What happens is, when the use clicks cmdOpenMsn, it trys to open msn. If it can't find it, then a msgbox is display(yes no cancel) vbYes is pressed 2 open CommonDialog to find it itself. I was thinking maybe that I should save the address of program in a text file or something. But 1 step at a time.
If you press no, the msgbox disappears and the WebBrowser1 navigates to the website url.
Cancel simply returns back to the screen with WebBrowser1
any who, heres the code;
Private Sub cmdOpenMsn_Click()
Dim retVal As Long
Dim strPath As String
strPath = "c:\Program Files\Mesenger\msmsgs.exe"
On Error GoTo ErrorHandler
Shell strPath
Exit Sub
ErrorHandler:
retVal = MsgBox("This file cant be found." & vbCrLf & _
"Do you want to search for it?", vbYesNoCancel + vbCritical, "Error!")
Select Case retVal
Case Is = vbYes
CommonDialog.Filter = "Msmsgs.exe|*.exe|"
CommonDialog.ShowOpen
If CommonDialog.FileName <> "msmsgs.exe" Then
strPath = CommonDialog.FileName
Exit Sub
Case Is = vbNo
WebBrowser1.Navigate2 "http://www.excite.com"
Case Is = vbCancel
Exit Sub
End Select
End Sub
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
|