Solved

How to activate a winword document after a form is shown

Posted on 2008-10-22
1
636 Views
Last Modified: 2013-12-20
Hi,

I have a simple problem, but I am not able to solve in.

I am programming in word 2003 vba. If the user clicks on a menü entry the frmTextmarkenEditor is show. The form tells the user that he should cklick on the document and a textmark or a formfield is created on the place he puts his mouse click.

To realize this I have created an event WindowSelectionChange wich opens another form for the user as soon as he clicks on the document.

My problem:
After the form frmTextmarkenEditor is opened, modal = false, I am not able to activate the document in a way, that on the first click of the user the WindowSelectionChange is activated. The user has to click two times instead of one time to activate the WindowSelectionChange.

With the attached code I am able to activete thisdocument, but the cursor is not blinking and I think this is the reason why the user has to click two times to activate the WindowSelectionChange. With the attached code the user has to click two times to see the message SelectionEreignis even the form frmTextmarkeneditor has not the focus anymore.
 I want to avoid that the user has to click two times.

Please help. How can I activate the document in a way so that with a single click of the user, the WindowSelectionChange is activated.

Thanks
in this document:
 
Option Explicit
 
Private WithEvents app As Application 
 
Private Sub app_WindowSelectionChange(ByVal Sel As Selection)
    
  If frmTextmarken2.Visible = False Then
                MsgBox "SelectionEreignis"
  End If
    
End Sub
 
 
'and this sub is my problem. It is called from a menu button
 
Public Sub TextmarkenEditor()
 
 
frmTextmarken.Show
'MsgBox "TextmarkenEditor Aufruf"
AppActivate (ActiveDocument)
ThisDocument.Activate
 
End Sub

Open in new window

0
Comment
Question by:rolandkg1001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
rolandkg1001 earned 0 total points
ID: 22832924
Thanks, I have found the solution.

In line 23 I use
Application.Activate

That works fine
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question