Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2014, 12:13 AM
meenagrace meenagrace is offline How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Windows 8 How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Office 2010 64bit
Novice
How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document
 
Join Date: Nov 2014
Posts: 2
meenagrace is on a distinguished road
Default How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document


When I try to compare documents using Microsoft.Office.Interop.WordApplication.CompareDo cuments in C# , warning dialog box is displayed. how to close/avoid that dialog box programmatically.

I have set IgnoreAllComparisonWarnings as true and Destination as wdCompareDestinationNew in WordApplication.CompareDocuments method. Warning dialog shown on newly created comparison result document.
Reply With Quote
  #2  
Old 11-06-2014, 06:13 PM
macropod's Avatar
macropod macropod is offline How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Windows 7 64bit How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by meenagrace View Post
When I try to compare documents using Microsoft.Office.Interop.WordApplication.CompareDo cuments in C# , warning dialog box is displayed. how to close/avoid that dialog box programmatically.
Without knowing what the warning dialog box is, it's impossible to say. The following runs to conclusion in VBA without any warning dialog boxes being displayed.
Code:
Sub Demo()
Dim DocOld As Document, DocRev As Document, DocCmp As Document
Set DocOld = Documents.Open("C:\Users\" & Environ("UserName") & "\Documents\Original.docx", AddToRecentFiles:=False, Visible:=False)
Set DocRev = Documents.Open("C:\Users\" & Environ("UserName") & "\Documents\Modified.docx", AddToRecentFiles:=False, Visible:=False)
Set DocCmp = Application.CompareDocuments(OriginalDocument:=DocOld, RevisedDocument:=DocRev, Destination:=wdCompareDestinationNew)
DocOld.Close False: DocRev.Close False
DocCmp.Activate
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-07-2014, 04:27 AM
meenagrace meenagrace is offline How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Windows 8 How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Office 2010 64bit
Novice
How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document
 
Join Date: Nov 2014
Posts: 2
meenagrace is on a distinguished road
Default

I have attached screenshot of warning dialog which is displayed after Word.Application.CompareDocuments. All i want to do in this scenario is either close dialog box or kill winword.exe process programmatically.
Attached Images
File Type: png wrngDialog.png (10.1 KB, 18 views)
Reply With Quote
  #4  
Old 11-07-2014, 01:29 PM
macropod's Avatar
macropod macropod is offline How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Windows 7 64bit How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That alert has nothing to do with the comparison, really. It's telling you the document has a corrupt table. You should fix that. Instead of using 'Open and Repair' as the dialogue suggests, corrupt tables can often be 'repaired' by converting the tables to text and back again or by saving the document in RTF format, closing the document then re-opening it and re-saving in the doc(x) format – or see the macro below.
Code:
Sub TableRepair()
'Macro to repair damaged tables by saving each table in an RTF-format file, then
' reinserting the table from the RTF-format file into the source document.
Application.ScreenUpdating = False
Dim Rng As Range, i As Long, RTFDoc As Document, strPath As String
With ActiveDocument
  strPath = .Path & "\"
  For i = .Tables.Count To 1 Step -1
    Set Rng = .Tables(i).Range
    Set RTFDoc = Documents.Add(Visible:=False)
    With RTFDoc
      .Range.FormattedText = Rng.FormattedText
      .SaveAs2 FileName:="strPath & RTFDoc.RTF", Fileformat:=wdFormatRTF, AddToRecentFiles:=False
      .Close
    End With
    Set RTFDoc = Documents.Open(FileName:="strPath & RTFDoc.RTF", AddToRecentFiles:=False, Visible:=False)
    Rng.Tables(1).Delete
    With RTFDoc
      Rng.FormattedText = .Tables(1).Range.FormattedText
      .Close
    End With
    Kill "strPath & RTFDoc.RTF"
  Next
End With
Set Rng = Nothing: Set RTFDoc = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
word 2010

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save as and Open dialog boxes blank stuartmush Word 1 09-20-2013 03:04 PM
Asian typography in text boxes - how to avoid lines starting with periods markpete Word 0 11-17-2012 01:45 PM
Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass manishjoisar Excel Programming 0 03-01-2012 02:53 AM
How to dismiss/avoid warning/alert dialog boxes in Microsoft.Office.Interop.Word.Document How do I get rid of a password in a Microsoft Office document? Antonio Machado Word 1 08-11-2010 02:29 AM
Font size in dialog boxes nannycheryl Word 0 07-10-2010 09:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft