We are displying a Word Document in a Iframe on an .aspx page. This Document was created using VSTO and in it we have an ActionsPane. We use it to insert bookmarks onto the Document by double-clicking in a listbox. All that works fine, but my problem resides in the foucs after we insert a bookmark. The focus remains on the listbox, NOT the Document, which I need. I have tried this:
doc.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekMainDocument
It works fine in just the Document, but in the browser it doesn't. I know it is not meant to be in a browser, but does anyone have any ideas Or is there just not hope for that
Or any suggestions would be great, even if it taking a completely different approach.
Thanks!
Focus after bookmark insert?
Electronic Screw
This does NOT work for me :(
Globals.ThisDocument.Application.ActiveWindow.SetFocus();
I think it is because my user control with the listbox is part of the ActiveWindow. Is there a way to set focus to the actual Document
Mark Levison
Hi Brenda,
Globals.ThisDocument.Application.ActiveWindow.SetFocus();Calling following method in Word OM does the job, even is the document is open within an IFRAME. There is a corresponding method in the Excel OM too.
This seems to work in any VSTO solution. But no one, even in VSTO team, seems to know about it, so, I am not sure if it works in all situations.
Let us know if this helps you. Thanks.
Samer Selo
Well, I have a solution (not the best, but it is what we are going to use).
doc.Application.Dialogs(Word.WdWordDialog.wdDialogFileSummaryInfo).Show(
1)It flashes really quickly, and the users would rather see thatfor 1/1000 of a second then click back on the docment.
The end.
Mister_Vee
I've never ever found another solution (tried for a while), but let me know if you find one ;)
Brenda
thanks
Any other solution for this problem
JanT [MVP]
This doesn't work either :(
Application.SendKeys("{F6}", this.missing);
Bummer huh Have any other things I can try Browsers sure cause problems in programming sometimes :(
Sergey Dubinets
Sorry it didn't work. I had a simple ActionsPane control with a list box and it was working there.
There is always a "brue force" way :-) It's the only known way that generally works. see: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=266980&SiteID=1&mode=1
I don't kow if it will work when the document is embedded in an IFRAME. Let us know what happens.