F
frogman
I have a macro that finds all the hidden text and deletes it but if the
text is in a table the rows stay. What I would like to find is if the
row is hidden then delete that row. I also have an instance where
there is hidden text in a table cell and I just want the text to be
deleted.
Code to delete all hidden text
Sub SendToClient()
Application.ScreenUpdating = False
Dim strNewName, strFileName, strLength, strFilePath As String
strFileName = ActiveDocument.Name
strFilePath = ActiveDocument.FullName
strLength = (Len(strFilePath))
strNewName = Left(strFilePath, strLength - 4)
ActiveWindow.View.ShowHiddenText = True
With Selection.Find
.ClearFormatting
.Font.Hidden = True
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.ActiveDocument.SaveAs (strNewName & "ClientCopy.DOC")
Application.ActiveWindow.ActivePane.View.ShowAll = False
Application.ScreenUpdating = True
End Sub
Code that needs help to find the hidden rows
'''Sub SendToClient()
'''Application.ScreenUpdating = False
'''Dim strFilePath, strFileName, strLength, strNewName As String
'''Dim intCountBold, intCount, i As Integer
'''strFileName = ActiveDocument.Name
'''strFilePath = ActiveDocument.FullName
'''strLength = (Len(strFilePath))
'''strNewName = Left(strFilePath, strLength - 4)
'''
'''Application.ActiveWindow.ActivePane.View.ShowAll = True
'''Selection.HomeKey unit:=wdStory
''' Selection.Find.ClearFormatting
''' With Selection.Find
''' .Text = ""
''' .Replacement.Text = ""
''' .Forward = True
''' .Wrap = wdFindContinue
''' .Format = True
''' .Font.Italic = True
''' .Font.Color = wdColorBlue
''' .Font.Hidden = True
''' .MatchCase = False
''' .MatchWholeWord = False
''' .MatchWildcards = False
''' .MatchSoundsLike = False
''' .MatchAllWordForms = False
''' End With
''' Selection.Find.Execute
'''
''''Loop through and find all tables and hide the tables
''' While Selection.Find.Found
''' Selection.Tables(1).Delete
''' Selection.HomeKey unit:=wdStory
''' Selection.Find.Execute
''' Wend
'''
''''Find all the hidden text
''' Selection.Find.ClearFormatting
''' With Selection.Find
''' .Text = ""
''' .Replacement.Text = ""
''' .Forward = True
''' .Wrap = wdFindContinue
''' .Format = True
''' .Font.Hidden = True
''' .MatchCase = False
''' .MatchWholeWord = False
''' .MatchWildcards = False
''' .MatchSoundsLike = False
''' .MatchAllWordForms = False
''' End With
''' Selection.Find.Execute
'''
''''Loop through and delete all the hidden text
''' While Selection.Find.Found
''' Selection.Delete
''' Selection.Find.Execute
''' Wend
'''Application.ActiveDocument.SaveAs (strNewName & "ClientCopy.DOC")
'''Application.ActiveWindow.ActivePane.View.ShowAll = False
'''Application.ScreenUpdating = True
'''End Sub
text is in a table the rows stay. What I would like to find is if the
row is hidden then delete that row. I also have an instance where
there is hidden text in a table cell and I just want the text to be
deleted.
Code to delete all hidden text
Sub SendToClient()
Application.ScreenUpdating = False
Dim strNewName, strFileName, strLength, strFilePath As String
strFileName = ActiveDocument.Name
strFilePath = ActiveDocument.FullName
strLength = (Len(strFilePath))
strNewName = Left(strFilePath, strLength - 4)
ActiveWindow.View.ShowHiddenText = True
With Selection.Find
.ClearFormatting
.Font.Hidden = True
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.ActiveDocument.SaveAs (strNewName & "ClientCopy.DOC")
Application.ActiveWindow.ActivePane.View.ShowAll = False
Application.ScreenUpdating = True
End Sub
Code that needs help to find the hidden rows
'''Sub SendToClient()
'''Application.ScreenUpdating = False
'''Dim strFilePath, strFileName, strLength, strNewName As String
'''Dim intCountBold, intCount, i As Integer
'''strFileName = ActiveDocument.Name
'''strFilePath = ActiveDocument.FullName
'''strLength = (Len(strFilePath))
'''strNewName = Left(strFilePath, strLength - 4)
'''
'''Application.ActiveWindow.ActivePane.View.ShowAll = True
'''Selection.HomeKey unit:=wdStory
''' Selection.Find.ClearFormatting
''' With Selection.Find
''' .Text = ""
''' .Replacement.Text = ""
''' .Forward = True
''' .Wrap = wdFindContinue
''' .Format = True
''' .Font.Italic = True
''' .Font.Color = wdColorBlue
''' .Font.Hidden = True
''' .MatchCase = False
''' .MatchWholeWord = False
''' .MatchWildcards = False
''' .MatchSoundsLike = False
''' .MatchAllWordForms = False
''' End With
''' Selection.Find.Execute
'''
''''Loop through and find all tables and hide the tables
''' While Selection.Find.Found
''' Selection.Tables(1).Delete
''' Selection.HomeKey unit:=wdStory
''' Selection.Find.Execute
''' Wend
'''
''''Find all the hidden text
''' Selection.Find.ClearFormatting
''' With Selection.Find
''' .Text = ""
''' .Replacement.Text = ""
''' .Forward = True
''' .Wrap = wdFindContinue
''' .Format = True
''' .Font.Hidden = True
''' .MatchCase = False
''' .MatchWholeWord = False
''' .MatchWildcards = False
''' .MatchSoundsLike = False
''' .MatchAllWordForms = False
''' End With
''' Selection.Find.Execute
'''
''''Loop through and delete all the hidden text
''' While Selection.Find.Found
''' Selection.Delete
''' Selection.Find.Execute
''' Wend
'''Application.ActiveDocument.SaveAs (strNewName & "ClientCopy.DOC")
'''Application.ActiveWindow.ActivePane.View.ShowAll = False
'''Application.ScreenUpdating = True
'''End Sub