Application Object Issues Converting to Office 2013

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:53
Joined
Feb 28, 2001
Messages
30,566
We are in the process of converting some Office 2010 apps to Office 2013 (32-bit) and have found a couple of oddball cases that seem somehow to be related or at least similar. In both cases, what we are trying to do is show something from another application when Access is running the show.

Case 1: Access wants to open a Word file to a specific bookmark but it won't do it. We open the document read-only, then tell Word to go to the bookmark. In 2010, the document would pop up to full screen and jump to the bookmark. In 2013, the document stays in the background and won't jump to the bookmark.

Case 2: Access wants to create a mail message in Outlook. In 2010, we open Outlook, open up the "Inspector" and eventually build the mail message. Outlook 2010 immediately takes over so that we can diddle with the recipient lists, signature, and perhaps add an attachment in some cases. Works fine. In 2013, the message gets created but we never get to actually see it. We can see it by working offline so that we can look in the Outbox and find that the message WAS created - but Outlook never popped up to show that fact to us.

The common theme is that another app SHOULD - but DOES NOT - get focus when we try to open it in 2013, but the same exact code works fine in 2010 for two different apps. In my feeble little mind, this seems to be common behavior, though perhaps I should know better.

I have done some web searches but so far nothing shows up that makes sense. I certainly would consider the possibility that I might not know the correct keywords to make the search turn up what I wanted, but right now I am drawing a blank online.

Any suggestions of what might be happening? Any suggested keywords for further searches? Either kind of response would be helpful.
 
could you not try .visible = true or appactivate or something similar? I remember having a similar sort of issue with word automation on 2013 which was something to do with the filetypes

HTH! If you do find the solution please post !
 
Thanks, MH123. I'll verify that I set the "visible" markers appropriately - though I think I do that anyway. To be honest, I haven't touched that part of the code for a while since we got it working. (Wasn't broken - didn't try to fix... but now it's broken again.)
 
I was forced by circumstances to step away from this for a moment. I'll be working on it again soon. I'm beginning to think that for Office 2013 I'll need to use the DoEvents method a bit more often. I'll post back when I've got it tested a bit more.
 
The problem I am getting now is that it is now complaining about the following:

oWd.ActiveDocument.GoTo what:=wdGoToBookmark, name:=vBkMk
oWd.ActiveDocument.ActiveWindow.View.ShowBookmarks = False

(Where oWd is the Word Application Object). It says that the ShowBookmarks command is not available for reading - but it used to be in Office 2010. For what it is worth, the document does open up to the right bookmark, but that command was supposed to switch windows and not show the actual bookmark. I.e. the GoTo bookmark worked but for Office 2013, it didn't make the Word window active.
 
Hm may sound silly but maybe a reference issue? Have you tried the ol latebinding route to see if that has any luck with your little hurdle? Probably take some digging in the object browser but may work?
 
After some research, I found that I wasn't alone. Apparently, Word 2013 changed behavior regarding things open for "Reading View."

My solution was to recognize that I could pick up the window handle without searching.

lWind = oWd.ActiveDocument.ActiveWindow.hWnd

Then you can find all sorts of things on the web to force a window to "come to the front" with a single system call. That did the trick.
 

Users who are viewing this thread

Back
Top Bottom