All right, I am on the bleeding edge on this one. Hope someone can help out:
A Notes form contains an embedded Excel 2002 object and, when a new doc is created or existing doc is opened, the form’s “Launch First OLE object” runs. The other parameters in the form’s launch tab are: Create Object In Field (“none”), Launch When (creating, editing, reading), Hide When (“none”).
Basically, this brings up Excel, and allows me to use it as a interface for some heavy number processing. I access the object with notesUIdocument.GetObject(“name of sheet”), then use Excel methods to do what I will, including pumping in data.
Here’s the rub: if I use the code below in the PostOpen event (when the object has not yet become visible, but is activated), the load time is 1.85 seconds (and I have a lot more than this little bit of data); when I use the identical code as an action, and press it after the sheet is fully up in the Notes window, the time is 0.55 seconds.
Intrigue: when I add a messagebox line to the PostOpen event, I get the same, fast results, suggesting that the Notes UIdoc needs a nudge before I turn my attention back to the sheet. So, I have got to activate the Notes interface before loading my data. But how?
I have tried writing to a uidoc field, printing to the status bar, and adding a Sleep command to my code. I have also tried numerous “Activate” and “Enable” methods within the Excel OLE interface. No good.
Anybody walked this path before?
Here’s the utterly simple code:
Set obj = source.GetObject(“Microsoft Excel Worksheet”)
’ Msgbox “test”
With obj.worksheets(1)
-'.enablecalculation = False (this type of thing made no difference)
-
For j = 0 To 1
-
- For i=0 To 40
-
-
- .cells(i, j).value = 123
-
-
- Next
-
Next
-'.enablecalculation = True
End With