home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch13code
/
listings
/
13list01.txt
next >
Wrap
Text File
|
1995-08-03
|
858b
|
30 lines
' File: 13LIST01.TXT
Private Sub OLE1_DblClick()
' Show FileOpen dialog to get a file to open.
CommonDialog1.FileName = "*.*"
CommonDialog1.ShowOpen
' Check if file exists before creating link
' (see Function below).
If FileExists(CommonDialog1.FileName) Then
' Attempt to create an embedded object.
OLE1.CreateLink CommonDialog1.FileName
End If
End Sub
' Checks if a file exists (uses full path and file name).
Function FileExists(strFileName) As Boolean
' Turn on error checking.
On Error Resume Next
' FileLen causes error if file doesn't exist.
FileLen (strFileName)
If Err Then
FileExists = False
Err = 0
Else
FileExists = True
End If
' Turn off error checking.
On Error GoTo 0
End Function