+ Reply to Thread
Results 1 to 2 of 2

GrammarBox goes underneath other applications when I call it, want to bring it to front.

Hybrid View

  1. #1
    Registered User
    Join Date
    06-18-2012
    Location
    Leamington SPa
    MS-Off Ver
    Excel 2010
    Posts
    6

    GrammarBox goes underneath other applications when I call it, want to bring it to front.

    Hi All,

    Hopefully this is a nice simple one for someone who knows more than I do. I have some code that runs a textbox through grammar checker in word. The only problem with it is that if I have anything else open then it hides underneath it and the only way to show it is by hitting the desktop button and then maximising the workbook again.

    If anyone has any suggestions I would be very grateful.

    Thanks, the code is as follows:

    Private Sub CommandButton2_Click()
    Dim objWord As Object
    Dim objDoc As Object
    Dim strResult As String
    
    'Create a new instance of word application
    Set objWord = CreateObject("Word.Application")
    
    Set objDoc = objWord.Documents.Add
    
    objDoc.Content = TextProjectDesc.Text
    objDoc.CheckGrammar  '''IT IS THIS THAT HIDES UNDERNEATH OTHER APPLICATIONS
    objWord.Visible = False
    
    strResult = Left(objDoc.Content, Len(objDoc.Content) - 1)
    
    strResult = Replace(strResult, Chr(13), Chr(13) & Chr(10))
    
    
    'Clean Up
    objDoc.Close False
    Set objDoc = Nothing
    objWord.Application.Quit True
    Set objWord = Nothing
    If TextProjectDesc.Text = strResult Then
        MsgBox "The Spelling check is complete, and there were no errors.", vbInformation + vbOKOnly
    End If
    
    ' Replace the slected text with corrected text
    TextProjectDesc.Text = strResult
    End Sub

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: GrammarBox goes underneath other applications when I call it, want to bring it to fron

    Hi

    try making the document visible = true immediately after
    objDoc.Content = TextProjectDesc.Text


    HTH

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1