home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- 'This module contains the OpenFile & CloseFile Subroutines.
-
- Global Const CC_RGBINIT = &H1& ' This is the Constant for
- ' the Flags property of the
- ' COLOR Common Dialog.
-
- Global Const CF_BOTH = &H3& ' This is the Constant for
- ' the Flags property of the
- ' FONTS Common Dialog. You
- ' can also use:
- ' CF_SCREENFONTS (&H1&)
- ' or CF_PRINTERFONTS (&H2&)
-
-
- Sub CloseFile(Filename As String)
- Dim F As Integer
- On Error GoTo CloseError ' If there is an error, display the error message below.
-
- If Dir(Filename) <> "" Then ' File already exists, so ask if overwriting is desired.
- response = MsgBox("Overwrite existing file?", MB_YESNO + MB_QUESTION + MB_DEFBUTTON2)
- If response = IDNO Then Exit Sub
- End If
- F = FreeFile
- Open Filename For Output As F ' Otherwise, open the file name for output.
- Print #F, Form1!txt.Caption ' Print the current text to the opened file.
- Close F ' Close the file
- Filename = "KF4ZPB Clock - FREEWARE" ' Reset the caption of the main form
- Exit Sub
- CloseError:
- MsgBox "Error occurred trying to close file, please retry.", 48
- Exit Sub
- End Sub
-
- Sub OpenFile(Filename As String)
- Dim F As Integer
- ' Instruction to open a file.
- If "Project Name Here: " + Filename = frmCD.Caption Then
- Exit Sub
- Else
- On Error GoTo ErrHandler
- F = FreeFile
- Open Filename For Input As F
- frmCD!txtCD.Text = Input$(LOF(F), F)
- Close F
- frmCD.Caption = "Project Name Here: " + Filename
- Exit Sub
- End If
- ErrHandler:
- MsgBox "Error occurred while trying to open file, please retry.", 48, "Project Name Here"
- Close F
- Exit Sub
- End Sub
-
-