1
我想在單獨的實例中打開工作簿。目前,此工作簿已保存在桌面上。我想打開一個新的工作簿,這個工作簿沒有保存或位於我係統的任何位置。以下是我現在的代碼。請指教。創建一個未保存的空白工作簿
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
歡迎來到Stackoverflow。請花時間來正確格式化您的代碼;它使閱讀起來更容易。您可以通過粘貼,全選,然後單擊工具欄按鈕或按Ctrl + K來格式化它,或者將它自己縮進四個或更多空格。您可以在文本區域的正下方以所見即所得的視圖進行預覽,以便在發佈前查看它。如果您需要更多格式幫助,您可以點擊文本區域右上角的橙色「?」按鈕。如果我們可以閱讀你的代碼,你有更好的機會獲得helo。 :-) –