CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    [RESOLVED] Closing a Word Document & Application

    Hello guys.

    I'm getting really really frustrated with Word's Document Recovery Pane everytime I launch Word - it is making me very mad!

    I'm busy with a program which assists me with all my exams, right, now, with this program I'm launching each program associated with each exam. After the document / spreadsheet etc. is shown, I mark what I need to, then, I have a button which closes the current process, and returns me to my default application interface.

    All this is working, except for the .doc files, Word files.

    Everytime I launch word, I get the Document recovery pane!

    I've tried the following :
    Code:
      If SSSubject = "WINWORD" Then
                        For Each SSProcess In SSNoteProcess
    
                            SSProcess.CloseMainWindow()
                            SSProcess.Kill()
                        Next
    
                        Dim winHwnd As IntPtr
                        winHwnd = FindWindow(vbNullString, SSSubjectFold)
                        If Not winHwnd.Equals(IntPtr.Zero) Then
                            PostMessage(winHwnd, WM_CLOSE, 0, 0)
                        End If
                    End If
    As a last resort ( and this doesn't work ), because WordDocument.close does not work, WordApplication.Quit does not work!

    By, saying it doesn't work, means it closes everything, yes, but the Document Recovery PAne always shows up, and I can't understand why!

    Is there some way of disabling it completely ¿
    I know some will say it is not a good idea, I know, I know I really need to get rid of it.

    Please, please, please, if anyone can help me it will be greatly appreciated

    // At the rate I'm pulling out my hair today, I'll be bald soon....

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Closing a Word Document & Application

    Save all the files (again) before you close it.

    I don't like to see you killing any processes without letting them shut down. It's a guaranteed way to get errors.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Closing a Word Document & Application

    The cause of this (the showing of the recovery pane) might be some word recovery files sitting somewhere in temp folder, try to delete them.

    check this path (Vista)
    Code:
    C:\Users\USER\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Closing a Word Document & Application

    Thank you guys, especially memeloo!

    Your idea sparked another idea
    I've found that You need to remove the keys under "DocumentRecovery" at the following
    registry location for
    HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Resiliency\DocumentRecovery.

    That has solved the issue, thanx!

    memeloo, I'll rate you as soon as I can

  5. #5
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: [RESOLVED] Closing a Word Document & Application

    This registry key is new to me, so I'll keep your part in mind too, in case I should need it someday ;]
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured