内存的奇怪问题
Function filetext(ByVal FileName As String) As String ' 判断文件存在性 If Len(Dir$(FileName)) = 0 Then Err.Raise 53 '文件没有找到 End If ' 以binary模式打开文件 handle = FreeFile Open FileName$ For Binary As #handle ' 读取内容,关闭文件 filetext = Space$(FileLen(FileName)) Get #handle, , filetext Close #handleEnd Function外部调用:CommonDialog1.ShowOpenCommonDialog1.CancelError = TrueRichTextBox1 = ""RichTextBox1 = filetext(CommonDialog1.FileName)