UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Returning focus on the Access window    
 
   
StillLearning
post Sep 5 2006, 12:02 PM
Post #1

UtterAccess Veteran
Posts: 413
From: Montreal, Canada



Hi everyone!

I searched for posts about returning the focus on the Access window after opening a word doc but I can't seem to find one. I tried this but it doesn't seem to work.

my code would be something like:

CODE
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add(strFilePath & strFileName)
objWord.Visible = True
[color="red"]'Missing line : Return focus to Access window [/color]
DoCmd.SelectObject acReport, strDocName


Any idea ?
Go to the top of the page
 
+
freakazeud
post Sep 5 2006, 12:48 PM
Post #2

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
so you can't just return focus to something within the Access shell?
Have you tried the SetForeGroundWindow API or the SetActiveWindow API? There should be samples for both in the links.
HTH
Good luck
Go to the top of the page
 
+
StillLearning
post Sep 5 2006, 02:44 PM
Post #3

UtterAccess Veteran
Posts: 413
From: Montreal, Canada



Hi Oliver,

I tried both and it doesn't do anything. I don't understand why...

For now I can use

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add(strFilePath & strFileName)
objWord.Visible = True'
SendKeys "%{TAB}"
DoCmd.SelectObject acReport, strDocName

but I'd like to have a better solution.

Thanks again! I'll keep trying your examples...
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 11:41 AM