Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

Sub SCForm()

ActiveDocument.Select
Selection.WholeStory
Selection.LanguageID = wdEnglishUS
ActiveDocument.CheckSpelling
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub
Sub FindMultiItemsInDoc()
Dim objListDoc As Document
Dim objTargetDoc As Document
Dim objParaRange As Range, objFoundRange As Range
Dim objParagraph As Paragraph

Set objTargetDoc = ActiveDocument


Set objListDoc = Documents.Open(FileName:="D:\References.docx")
objTargetDoc.Activate

For Each objParagraph In objListDoc.Paragraphs


Set objParaRange = objParagraph.Range
objParaRange.End = objParaRange.End - 1

With Selection
.HomeKey Unit:=wdStory

' Find target items.


With Selection.Find
.ClearFormatting
.Text = objParaRange
.MatchWholeWord = True
.MatchCase = False
.Execute
End With

' Highlight the found items.


Do While .Find.Found
Set objFoundRange = Selection.Range
objFoundRange.HighlightColorIndex = wdBrightGreen
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Next objParagraph
End Sub

Sub Macro9()
'
' Macro9 Macro
' enable editing permanently
'
ChangeFileOpenDirectory "D:\"
ActiveDocument.SaveAs2 FileName:="Test.doc", FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, CompatibilityMode:=0
ActiveWindow.Close
Application.Quit
End Sub

Sub Macro300()
'
' Macro300 Macro
' delete comments, accept all changes, correct grammar, and save
'

Dim tbl As Table


For Each tbl In ActiveDocument.Tables
tbl.Rows.AllowBreakAcrossPages = True
Next

Dim n As Long
Dim oComments As Comments
Set oComments = ActiveDocument.Comments
For n = oComments.Count To 1 Step -1
oComments(n).Delete
Next 'n
Set oComments = Nothing

ActiveDocument.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.ShowGrammaticalErrors = False
ActiveDocument.ShowSpellingErrors = False
ActiveDocument.Range.NoProofing = True
ActiveDocument.AcceptAllRevisions
ActiveDocument.TrackRevisions = False
ActiveDocument.Save
ActiveWindow.Close
End Sub
Sub Macro302()
'
' Macro302 Macro
' finale
'

Dim file
Dim path As String

path = "C:\Users\nnadkarni\Desktop\PayGate\"

file = Dir(path & "*.docx")

Do While file <> ""


Documents.Open FileName:=path & file
Application.Run MacroName:="Macronew"

file = Dir()
Loop
End Sub

You might also like