![]() |
|
|
|
#1
|
||||
|
||||
|
On its own, the macro doesn't make any changes to your document. Evidently, though, your document contains some other volatile content that Word is updating. You might be able to prevent the unwanted 'Save' prompts with: Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, bSvd As Boolean
With ActiveDocument
bSvd = .Saved
j = .ComputeStatistics(wdStatisticWords)
With .Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[“" & Chr(34) & "]*[" & Chr(34) & "”]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
i = i + .ComputeStatistics(wdStatisticWords)
.Collapse wdCollapseEnd
.Find.Execute
Loop
MsgBox "This document contains " & j & " words ," & vbCr & _
"of which " & i & " (" & Format(i * 100 / j, "0.00") & _
"%) are in quotes."
End With
.Saved = bSvd
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Yes this works perfectly and without asking every time to save
I expect that there will be no problems with losing any data right? It is a stupid question since i am sure you would not publish such a code but still i need to ask. |
|
#3
|
||||
|
||||
|
The code won't cause you to lose any data. The modified version simply stores the document's current 'saved' state at the start and restores it at the end. That way, if you'd done some editing before running the macro, you'll still get the usual save prompts, etc. (as you will if you make any edits after running the macro), but you won't get them if you simply open the document, run the macro, then close it without further edits.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Straight Vs Curly Quotation Marks | FOsmund | Word | 4 | 04-16-2015 01:48 PM |
| Quotation marks are inserted in wrong font | sinz54 | Word | 5 | 01-11-2015 06:34 PM |
| Can't find space before closing quotation marks | wardw | Word | 7 | 01-16-2014 12:13 PM |
| How do I select everything that is in quotation marks? | Jophassa | Word | 4 | 09-02-2011 10:57 AM |
problem with automatic formatting on quotation marks
|
Bobosmite | Word | 3 | 05-27-2010 07:06 PM |