0

下面的代码在不同的模块中运行良好,但如果用于用户表单按钮则不能。它不会在即时窗口中打印文件的内容。我请求更正或指导。谢谢你

Private Sub UploadBut_Click()

Dim TextFile As Integer
Dim FilePath As String
Dim FileContent As String
Dim P As String

'BrowseFile.Value 是我的用户窗体中的一个文本框,它捕获文件的路径

If BrowseFile.Value = "" Then
MsgBox "Please Select File", , "Upload File"
Else
On Error Resume Next
P = Chr(34) & BrowseFile.Value & Chr(34)
TextFile = FreeFile

FilePath = P
FileContent = Input(LOF(TextFile), TextFile)
Debug.Print FileContent

Close TextFile
End If

End Sub
4

1 回答 1

0

我的天啊 !我是多么愚蠢。我刚刚删除了 Chr(34) (引号)并且它起作用了。

于 2016-07-25T13:59:45.403 回答