创build一个未保存的空白工作簿

我正试图在单独的实例中打开一个工作簿。 目前,此工作簿已保存在桌面上。 我想打开一个新的工作簿,这个工作簿没有保存或位于我的系统的任何地方。 下面是我现在的代码。 请指教。

Sub New_Excel() 'Create a Microsoft Excel instance via code 'using late binding. (No references required) Dim xlApp As Object Dim wbExcel As Object 'Create a new instance of Excel Set xlApp = CreateObject("Excel.Application") 'Open workbook, or you may place here the 'complete name and path of the file you want 'to open upon the creation of the new instance Set wbExcel = xlApp.Workbooks.Open("C:\Users\PRASHPRA\Desktop\Book.xls") 'Set the instance of Excel visible. (It's been hiding until now) xlApp.Visible = True 'Release the workbook and application objects to free up memory Set wbExcel = Nothing Set xlApp = Nothing End Sub 

如果您要创build一个新的空白工作簿,请停止尝试打开一个现有的工作簿。 只要改变一下

 Set wbExcel = xlApp.Workbooks.Open("C:\Users\PRASHPRA\Desktop\Book.xls") 

 'Add a new, empty workbook Set wbExcel = xlApp.Workbooks.Add 

有关更多信息,请参阅创build新工作簿 (该链接适用于Excel 2003,因为这是我通过Googlefind的第一个工具簿 ,但仍然适用,如果您想要更近的链接,则可以按照与我一样的方式find它)。