Attribute VB_Name = "modFileOps" Function GetFileNumber() As Integer ' I know this seems redundant but I want to be able to read the code ' more easily with better function names. And we will need to know what ' the file number is in some cases during multiple opens and selected closes. GetFileNumber = FreeFile End Function Function FileExists(FileName As String) As Boolean ' This function will avoid bad drive errors while searching for a file. On Error Resume Next FileExists = Dir$(FileName) <> "" If Err.Number <> 0 Then FileExists = False On Error GoTo 0 End Function Public Function OpenFile(FileName As String, FileNumber As Integer, KillIfExists As Boolean) As Boolean OpenFile = True ' lets establish the default state of OpenFile. If FileExists(FileName) Then ' find out if its really there. If KillIfExists Then Kill FileName 'Are we supposed to zap it? If so, do it. Open FileName For Output As #FileNumber ' Autokill and roll on. Else Response = MsgBox("The File " & FileName & " already exists. Overwrite?", _ vbYesNo + vbCritical + vbDefaultButton2, "Overwrite Confirmation") If Response = vbYes Then ' User chose Yes. Open FileName For Output As #FileNumber ' User reponded to Overwrite file. Continue Else OpenFile = False ' Bail. User abort. End If End If Else Open FileName For Output As #FileNumber ' create the file, it doesnt exist End If End Function Public Function AddFileEntry(FileNumber As Integer, Column As Integer, LogEntry As String) As Boolean Print #FileNumber, Tab(Column); LogEntry End Function Public Function CloseFile(FileNumber As Integer) As Boolean ' pretty straight forward close the file Close #FileNumber End Function>>>Can somebody tell me what's wrong with this code? I get an error message about the OPENFILE procedure (Sub or Function not defined) when I put it in the click event of a command button.
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams