S
Stewart
I posted the following a few days ago, but still have gotten no response. Trying again with more detail.
I'm embedding Excel in a VB app, and I've found that when the user is editing the formula in a cell, that certain automation calls hang - they bring up VB's Switch To/Retry/Cancel dialog. Is there any way to programmatically click the checkmark to get out of formula edit mode so that the document may manipulated?
To reproduce, create a form with a button and a webbrowser control. Add the following code. Then launch the app, wait while the spreadsheet is loaded, add some content, and while a formula is being edited (the x and checkmark next to the formula bar are visible), click the button. If the x and checkmark are not visible, then it will work, you can do something like set the button's caption to the activecell's formula if you like, but while the formula is being edited, this causes the hang. It had been suggested that this was due to asynchronous loading, but this is not the case. It is because Excel refuses certain automation calls while the formula is being edited.
Private Sub Command1_Click()
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim w As Excel.Window
Set wb = WebBrowser1.Document
Set ws = wb.ActiveSheet
Set w = wb.Windows(1)
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate2 "file:///C:/test.xls"
End Sub
I'm embedding Excel in a VB app, and I've found that when the user is editing the formula in a cell, that certain automation calls hang - they bring up VB's Switch To/Retry/Cancel dialog. Is there any way to programmatically click the checkmark to get out of formula edit mode so that the document may manipulated?
To reproduce, create a form with a button and a webbrowser control. Add the following code. Then launch the app, wait while the spreadsheet is loaded, add some content, and while a formula is being edited (the x and checkmark next to the formula bar are visible), click the button. If the x and checkmark are not visible, then it will work, you can do something like set the button's caption to the activecell's formula if you like, but while the formula is being edited, this causes the hang. It had been suggested that this was due to asynchronous loading, but this is not the case. It is because Excel refuses certain automation calls while the formula is being edited.
Private Sub Command1_Click()
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim w As Excel.Window
Set wb = WebBrowser1.Document
Set ws = wb.ActiveSheet
Set w = wb.Windows(1)
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate2 "file:///C:/test.xls"
End Sub