Hello. I am having an issue with some code. The goal is to click a commandbutton on a userform that will close the current form and excel app and open a specific workbook in a specific directory. For the sake of development, the dummy workbook to be opened upon click is located in a folder on my desktop for now.
Now, each time I click the commandbutton, it DOES close excel and it does open the new workbook. However, the userform with the commandbutton remains frozen with an hour glass. After a few moments the error returns: Excel waiting for another application to complete an OLE action.
To eliminated the error dialogue box, i added the string: Application.DisplayAlerts = False.
Yes, that got rid of the dialogue box, but it still hangs up.
Here is the code I have for the commandbutton:
Private Sub BTN_BLANK_Click() Application.DisplayAlerts = False Dim appExcel As Excel.Application Dim myWorkbook As Excel.Workbook Set appExcel = CreateObject("Excel.Application") Set myWorkbook = appExcel.Workbooks.Open("C:\Users\Director\Desktop\C\PolyFilm Group\New\NEW BLANK SCHEDULE.xls") appExcel.Visible = True Set appExcel = Nothing Set myWorkbook = Nothing ActiveWorkbook.Save Application.EnableEvents = False Application.Quit End Sub
Bookmarks