我们看下面的代码:Public myfile As String '定义文件中要利用到的EXCEL文件。Private Sub CommandButton3_Click '打开文件。Set XLApp = CreateObject。'设置要打开的文件。