avoiding hang when formula is being edited

G

Guest

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
 
P

Peter Huang

Hi Stewart,

I have replied to the other post in this thread.
Subject: RE: hang when formula bar open
Newsgroups: microsoft.public.excel.programming

You may go and take a look, if you still have any concern, please feel free
to post there and I will follow up.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top