Jaafar Tribak
Well-known Member
- Joined
- Dec 5, 2002
- Messages
- 9,779
- Office Version
- 2016
- Platform
- Windows
Hi all,
Let's assume we want to get a pointer to a workbook opened in a second insatnce of excel and edit a cell .. we would normally use something like this :
The above works as expected but if the workbook happens to be in edit mode or an excel dialog is currently on display (for example the data validation window) then the caller application starts hanging
One could check for the presence of the EXCEL6 window that becomes visible when excel enters edit mode and could also check if an XL dialog is on display by determining the foreground window in the excel process but that would be too much hassle and i am not sure it would even work because the caller code doesn't hang when a userform is on display or a Msgbox
Is there another simpler way ?
Let's assume we want to get a pointer to a workbook opened in a second insatnce of excel and edit a cell .. we would normally use something like this :
Code:
Sub Test()
Dim wb As Workbook
Set wb = GetObject("C:\MyBook.xls")
wb.Worksheets(1).Range("a1").Value = 10
End Sub
The above works as expected but if the workbook happens to be in edit mode or an excel dialog is currently on display (for example the data validation window) then the caller application starts hanging
One could check for the presence of the EXCEL6 window that becomes visible when excel enters edit mode and could also check if an XL dialog is on display by determining the foreground window in the excel process but that would be too much hassle and i am not sure it would even work because the caller code doesn't hang when a userform is on display or a Msgbox
Is there another simpler way ?