Solved Open a file without moving the focus

I didn't say that the one line solution would affect the focus only that it was far simpler than the code you were working with.
Sorry. My misunderstanding.

Are you sure that copying from the PDF wouldn't be useful to reduce typos?
Yes. Almost everything is selected from combo or list box. Company name, delivery address, etc.
Very few fields are typed. And they are numbers. (Order Quantity etc)

Thanks again for all the time you put on this.
 
Sure.
But remember, AppActivate may need adjustment on your computer. When I open Excel and a new workbook, I get a window called Book1 - Excel (but maybe you get something different). When I open Notepad, I get a window titled "Untitled - Notepad" (presumably you get the same thing, but maybe you don't).

Here are my results. You can see how effectively one line of code was the key.

View attachment 89620
Million thanks.
 
But you never checked moving focus to the current form AFTER the FollowHyperlink????
 
But you never checked moving focus to the current form AFTER the FollowHyperlink????
I did and I explained it in #3 post on first page.
object.SetFocus in vba acts within the application. When OS has moved the focus to a different window (another application), no matter how many times you change the focus within Access, OS is focused on another application. The active window is newly opened document and not Access. So all key strocks etc goes to that application and not Access.You can test it for yourself and you'll understand what I mean. @arnelgp 's solution works and it makes Access the active window.
 
If Arnel's solution worked, you might have mentioned it earlier. As long as you're happy, I'm happy. Sorry to belabor the point.
 
you might have mentioned it earlier.
They did, in post 16.

The only reason I kept going with AppActivate is because when you can do with one line of code that you understand and can maintain instead of 200 that you don't and cannot, that should always be encouraged. :)
 

Users who are viewing this thread

Back
Top Bottom