I seem to be stuck in a loop with:
This action cannot be completed because the other
application is busy. Choose 'Switch To' to activate
the busy application and correct the problem.
I can only Switch To or Retry neither give me back control.
The aim is to read and write to Sheet1. I was attempting to get the code working when this Dialog appeared. Perhaps someone can see what the probelm is ?
This action cannot be completed because the other
application is busy. Choose 'Switch To' to activate
the busy application and correct the problem.
I can only Switch To or Retry neither give me back control.
Code:
Sub Main()
Dim ExcelFile As String
Dim objExcel As Object, wb As Object
ExcelFile = getExcel 'returns Excel filename
If ExcelFile > "" Then
Set objExcel = CreateObject("excel.application")
Set wb = objExcel.workbooks.Open(ExcelFile)
objExcel.Worksheets("Sheet1").Activate
With objExcel
Debug.Print .cells(1, 1)
.cells(1, 1) = "test"
End With
End If
objExcel.displayalerts = False
objExcel.Save
objExcel.quit
End Sub