Word does not close

Author Lee

Lee


This person is a Verified Professional

This person is a verified professional.

Verify your account
to enable IT peers to see that you are a professional.

datil

This may shock all of you, but I figured it out on my own. :)

I disabled all application add-ins by clicking on the Microsoft office button, Word options, trust center, trust center settings, add-ins, disable all application add-ins (may impair functionality) — I did not care at this point — OK.

Thanks for all your help!

Why should we be shocked at that?  You were smart enough to use Spiceworks, so you must be smart enough to do that! :-)

Good luck.  You may be able to enable other add-ins one at a time to see what the actual culprit is.

Don’t forget to mark Best Answer and any Helpful Posts.


Was this post helpful?
thumb_up
thumb_down

I have a little program that opens a word document, does some changes on a table, exports it to PDF, and then closes the document and application. When I open the document again it still has my original changes in the table. It looks like it is being cached in some kind of way. Here is my code:

private void Open()
{
    appWord = new Microsoft.Office.Interop.Word.Application();
    appWord.DisplayAlerts = WdAlertLevel.wdAlertsNone;
    string path = Environment.CurrentDirectory + "\Resources\document1.docx";
    wordDocument = appWord.Documents.Open(path);
}      

Remove some rows from some tables and export to PDF

private void Close()
{
    object missing = Type.Missing;
    object doNotSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
    wordDocument.Close(doNotSaveChanges, missing, missing);
    System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocument);
    appWord.Quit(ref doNotSaveChanges, ref missing, ref missing);
    System.Runtime.InteropServices.Marshal.ReleaseComObject(appWord);
}

Am I closing the document in a wrong way? Or is it being cached? Some temp file that is saved somewhere? I don’t have any other word processes open.

Deduplicator's user avatar

Deduplicator

44.3k7 gold badges65 silver badges115 bronze badges

asked Jun 15, 2016 at 8:39

Joost Pielage's user avatar

6

The changes are not saved because when you are closing the doc, your are telling it not to save changes.

object doNotSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
wordDocument.Close(doNotSaveChanges, missing, missing);

Try this instead:

object saveChanges = WdSaveOptions.wdSaveChanges;
wordDocument.Close(saveChanges, missing, missing);

answered Jun 15, 2016 at 8:51

Abdulraheem Abid's user avatar

3

We actually use the following (shortened) code when closing a Word document:

object varFalse = false;
object missing = System.Type.Missing;

if (m_wordDoc != null)
{
    ((Microsoft.Office.Interop.Word.Document)m_wordDoc).Close(ref varFalse, ref missing, ref missing);
    //m_wordDoc = null;
}
if (m_wordApp != null)
{
    ((Microsoft.Office.Interop.Word.Application)m_wordApp).Quit(ref varFalse, ref missing, ref missing);
    //m_wordApp = null;
}

You’ll notice that we use a bool value for the first parameter. Still, the above code properly closes the document and the Word instance.

However, we create a temporary copy of the template Word file before we do stuff and export it as PDF. It could be that exporting the file as PDF implicitly saves the original, which doesn’t matter to us, as we delete the temporary file after the process.

answered Jun 15, 2016 at 13:03

Thorsten Dittmar's user avatar

Thorsten DittmarThorsten Dittmar

55.6k8 gold badges88 silver badges138 bronze badges

2

You may have some unwanted opened instance of your Word in your Task Manager.

Workink with COM in .Net requires to release com objects. More than that, you cannot use dots when working with word interop (or any other COM object) in .Net since between the dots, temporarly objects are created behind the scene and need to be released.

For example:

wordDocument = appWord.Documents.Open(path);

Should be replaced with

wordDocuments = appWord.Documents
wordDocument = wordDocuments.Open(path);

// Once done, you need to release those objects
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocument);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocuments);

You can look at this post, those are the same rules as in excel.

Community's user avatar

answered Jun 15, 2016 at 12:51

ehh's user avatar

ehhehh

3,4026 gold badges39 silver badges87 bronze badges

3

  • Remove From My Forums
  • Question

  • My company is using a document conversion program that accesses Microsoft Word in order to convert a document to a PDF.  It is supposed to open Microsoft Word and then immediately close it.  For some reason, Microsoft Word stays in a running state
    after it has been closed.  When watching the process happen it takes 1 minute and 3 seconds for the document to convert, when it’s supposed to be around 4 -6 seconds.  If you close out the running Word process, it will convert it immediately. 

    This is a fresh install of Word 2016 only.  If you open Microsoft Word itself, it has the same issue with the running process.  It doesn’t close it and will stay running until you manually end task.  Since Word does the same thing even without
    using the document converter program, I know that the issue is with Word, not the converter.  Any ideas?

    

  • I install some updates and now Microsoft word does not (no response program)

    Ive updated my pc and I was working on a program (Microsoft Word) and after that the words update his does not work it just said program addresses do not< how=»» do=»» i=»» get =»» patch=»» or=»» a=»» program=»» to=»» fix=»» my=»»>

    Quote your full version of Windows (for example, WinXP SP3;) Vista 64 — bit SP2; Win7 RC. Win7) when you post in a forum or a newsgroup. Please do it in your next reply. In this case, specify your version of Office (for example, Office 2007 SP1).

    What updates you installed just before this problem started? Assuming Vista or Win7, see Start | Control Panel | System maintenance and (if you use Classic view, skip this step) | Windows Update | Installed updates. ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Microsoft Word does not produced without license

    Original title: Microsoft does not

    I open Word to type a letter and the stop of the cursor

    On top, he produced without license

    What should I do?

    Review:

    Errors in product without license in Office — desk stand

    also

    Unauthorised product — Microsoft Support

  • Microsoft Word does not not after the installation of Windows Live.

    Problem solved after uninstalling windows live 1.4.

    Do you need all programs Windows Live, can choose you the ones that you really need?

    http://download.live.com/?SKU=Messenger&WA=wsignin1.0

  • Microsft Word does not

    I can’t open any of my Word documents I have previous created… also cannot start a new Word Document… I get the following error messages:

    Microsoft Word does not and then options to close the program or wait for the program to respond… with none of that always works

    also getting

    Micrsoft Word for Windows has stopped working

    A problem caused the program to stop working correctly, Windows will close the program and notify you if a solution is available… nothing happens… nothing sent

    Another mistake is very strange when I try to open Word or Open Office

    There was a problem sending the command to the program… on top of this error message lists P:Pogoplug CloudCanon reg doc 15% coupon.

    I am ready to throw this laptop out the window, I had this problem since the spring… I think I’ll go and delete such things Pogoplug

    Please, help me, I’m at my wits end… Andrea Donovan… …. (;-)

    Andrea

    In Windows 7, use Ctrl + Shift + Esc instead of Ctrl + Alt + Delete. It lets you in the Manager of tasks more quickly. When locking the computer select the Task Manager, performance, resource monitor tab and tab memory. What are the numbers for reserved equipment, in use, modification, sleep and free?

    Is your Windows 7 32-bit or 64-bit? The amount of RAM is installed?

    Select Start, Control Panel. Action Center, click on the down arrow to the right maintenance, click view reliability history. In the chart, you will see red orbs, click on one and it gives details and to the right are another link saying see technical details. You can copy and paste the description in a new message to. Repetition of reports are more relevant than the one off of problems.

  • Open the file does not close on a remote computer through the computer management console

    I try to use the MMC snap-in computer management to connect to a remote computer that contains our shared documents to close an open file on the remote user’s computer.  When I right click and select open close file, it seems closed in the MMC console, but the document is still open on the user’s computer.

    Why does not close the file?

    Hello

    Please post your question here for assistance with the MMC snap-in:

    https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

  • Microsoft Silverlight does not work

    Microsoft Silverlight does not. I tried to uninstall and reinstall it but the screen is always black without any control of player on my netflix account when I try to press play. Help?

    Hello

    1. what operating system is installed on the computer?

    2. what version of Internet Explore do you use?

    3 have there been recent changes to the computer before the show?

    Method 1:

    I suggest you follow these steps to turn on ActiveX of Netflix and check if it works.

    (a) double-click the Internet Explorer desktop icon to start the browser. Click on the Tools menu option
    (b) click on the Security tab in the Internet Options window. Click the Internet icon, and then on customize the level to start the security settings — Internet Zone window.
    (c) scroll down to the section ActiveX controls and plug-ins.
    (d) check enable for download signed ActiveX controls and run ActiveX controls and plug-ins check fast to download unsigned ActiveX controls.
    (e) click on OK to close the window and then security settings on OK in the Internet Options window.

    Method 2:

    How to clean a facility damaged Silverlight and then reinstall Silverlight:

    http://support.Microsoft.com/kb/2608523

    Method 3: If the problem persists, try to optimize Internet Explorer by following the steps mentioned in this link.

    How to optimize Internet Explorer:

    http://support.Microsoft.com/kb/936213/no

    Important: Reset Internet Explorer to its default configuration. This step will disable also any add-ons, plug-ins or toolbars that are installed. Although this solution is fast, it also means that, if you want to use one of these modules in the future, they must be reinstalled.

    Hope this information is useful.

  • Windows import program does not close after you import photos from a camera.

    Windows import program does not close after you import photos from a camera. It is frozen on the desk and the computer must be restarted to use the program again, windows does not detect a problem, how to fix it.

    original title: importer of photo and video for windows

    Hello

    1. which version of the operating system is installed on the computer?
    2. don’t you make changes on the computer before the show?

    Method 1:
    You can perform a clean boot and check if the problem occurs.
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135
    Note: After a repair, be sure to set the computer to start as usual as mentioned in step 7 in the Knowledge Base article.

  • In Vista, I am uable to assign Office Word as default program for .doc files. Microsoft Word is not an option. Any ideas?

    In Vista, I am uable to assign Office Word as default program for .doc files.  Microsoft Word is not an option.  Any ideas?

    Beginning

    Default programs

    Associate a file type or Protocol with a program

    Highlite .doc and select «change agenda.»

    The program recommended in does not (Adobe Reader in this case)

    Other programs shown don’t include microsoft word

    Have Vista SP2

    Have Microsoft Office Standard 2007

    Hello

    1. are you not able to set Microsoft word as your default program?
    2. don’t you make changes to the computer before the show?

    Try the following steps to configure word as the default application.

    (a) with the right button on a .doc file and select open with. If a menu appears, select Choose default program.

    (b) If Word 2010 does not here, click on the Browse button. Navigate to the C:Program FilesMicrosoft OfficeOffice12 directory.

    (c) search for and select the winword.exe file.

    (d) in both cases, check the always use the selected program to open this type of file.

    (e) click OK.

    Use the links below to set default programs in Windows.

    http://Windows.Microsoft.com/en-us/Windows7/change-the-program-that-opens-a-type-of-file

    http://Windows.Microsoft.com/en-us/Windows7/change-which-programs-Windows-uses-by-default

  • Windows does not close

    I have «Windows is shutting down» screen but it does not close and try to stop the virtual machine is not to do anything. What can I do?

    Choose the Virtual Machine menu, then hold the option key on your keyboard.  Case comments must take off Power.  Who should force on the virtual machine as if you were pulling the plug on a real machine.  Once you start up check to see if it continues to be.  It’s probably a windows service which stops not correctly.  If he continues to to choose Start > run then type msconfig.  In there, go to the area of services and the check hide all microsoft services and then click on disable all button.  Then go to the Startup tab and disable all there too.  Click ok, but restart again.  Send a CtrlAltdel command to the virtual machine in the virtual machine menu and then in Manager tasks start to leave the services there until she is very minimal.  Then restart.  Once rebooted try to stop again.  We expect that the virtual machine must close properly.  If Yes, then you can activate material in the section services and startup in msconfig, slowly, until you determine which item in it is causing the problem.

  • the custom words does not appear in my iPhone

    Hello

    I joined my iPhone IOS 10 6 more and I noticed that the custom words does not appear in my iPhone, even if I have them in my iTunes library. I signed up with the same Apple ID on all devices. Very few of them, I can access the lyrics in my phone, but not all of them (as he used to be in iOS 9)

    any help is appreciated.

    Thank you

    Ahmed

    I downloaded a program on my Mac (no app store unfortunately) called «get lyrical». automatically add lyrics to iTunes. Then in iTunes file > library > Update music library to iCloud. doing this during the last 20 minutes and so far it seems to work.

  • How can I order i-Tunes DOES NOT close automatically after 30 minutes… Despite having put in place to save energy to stay active for 2 hours?

    i mac OSX10-9-5 2015.   How can I order i-Tunes DOES NOT close automatically after 30 minutes… Despite having put in place to save energy to stay active for 2 hours?

    To the best of my knowledge iTunes has all of the features that could stop him. What make you believe it’s iTunes rather than some other power saving feature? What happens exactly 30 minutes? It’s happens during playback video or audio?

    TT2

  • «Private browsing» window does not close after opening web site

    «Private Browsing» window does not close after the opening of a web site; He remains on the side of wight of the screen and cannot be closed.

    It turns out that partially Wen site on the left side of the screen and can be closed.

    Problem solved. Bookmarks removed and replaced and now everything works according to plan.
    Thank you

  • Firefox does not close completely.

    So since I have updated to the new Firefox it does not completely close when I hit X to close. Then the next time I go to open it it says something like ‘ Firefox is open but does not close it before trying to open it again. Has not done this before and is getting pretty annoying having to open my task manager everytime I want to open Firefox.

    Is this a new problem with the new update, or something else in conflict?

    In case you use ‘Clear history of Firefox closing’ and then try to disable this feature.

    • Options > privacy > Firefox will be: «Use the custom settings for history»: [] ‘clear history of Firefox closing. «
  • Can’t stop Mac like Finder does not close

    I tried to cancel a copy of file on an external hard drive by clicking on the ‘x ‘. I get the message ‘stop’ to cancel it, but it happened for 24 hours now.

    Finder does not close because there is always this cancellation in operation.

    How can we get finder be forced to close or cancel it on my copy of file be forced to cancel properly?

    Any ideas please?

    Thank you

    Have you tried the Apple menu > force quit?

  • Avatar of madera_llc

    madera_llc

     asked on 8/13/2009

    When closing out MS Word 2007 (with or without a document open) — MS Word sort of closes but leaves a MS Word blue frame that does not close unless you click the X button several times and click the End Now or use the task manager to end the MS WORD process.

    Microsoft Word

    Avatar of undefined

    Last Comment

    madera_llc


    8/22/2022 — Mon

    michaelgoldsmith

    8/13/2009

    Have you tried an office repair?

    Click the Microsoft Office Button, and then click Word Options.
    Click Resources.
    Click Diagnose, click Continue, and then click Start Diagnostics.

    THIS SOLUTION ONLY AVAILABLE TO MEMBERS.

    View this solution by signing up for a free trial.

    Members can start a

    7-Day free trial

    and enjoy unlimited access to the platform.

    Tried the diagnose — it found no problems

    michaelgoldsmith

    8/13/2009

    You might try reinstalling Office from scratch.

    Removing the Add-Ins worked but took a loooooong time because MS Word locked up when I tried to remove them. I had to remove them one at a time.

    Понравилась статья? Поделить с друзьями:
  • Word does not check grammar
  • Word docx скачать бесплатно для андроид на русском
  • Word docx какого года
  • Word docvariable как изменить
  • Word documents with pictures