Forum Discussion
cindy_lu
Sep 16, 2022Copper Contributor
Excel file won't be opened while macro is running.
I have a long-running macro, which takes from several minutes to even an hour for executing. I found that while the macro is running, the excel file cannot be opened. All the excel files will only ...
HansVogelaar
Sep 16, 2022MVP
You can let users open a workbook (or workbooks) from the macro by using
Application.Dialogs(xlDialogOpen).Show
or you can prompt them to select a file by using
Dim vFile As Variant
Dim wBook As Workbook
vFile = Application.GetOpenFilename(FileFilter:="Excel Workbooks (*.xls*),*.xls*")
If vFile = False Then
' No workbook selected
Else
Set wBook = Workbooks.Open(vFile)
End Ifcindy_lu
Sep 21, 2022Copper Contributor
Thanks, this indeed make the file open once I embed this function as a button in my userform.
However, I would expect this problem be solved by the application itself. Not to compromise it with VBA codes...
However, I would expect this problem be solved by the application itself. Not to compromise it with VBA codes...