Quote:
Originally Posted by Guessed
I assume your macros are reliant on the selection object being in the first cell before running.
Code:
Sub AAA()
Dim aTbl As Table
For Each aTbl In ActiveDocument.Tables
aTbl.Range.Cells(1).Range.Select
Caption
Table1
Next aTbl
End Sub
|
Well, I thought I had the paragraph part down but that may have been a fluke.
Sub CaptionPort()
'
' Use this macro to replace captions and tables for portrait orientation
With Selection.Tables
Dim aTbl As Table
For Each aTbl In Selection.Tables
aTbl.Range.Cells(1).Range.Select
Caption
Table1
Next aTbl
End With
End Sub
After the macros run there are two paragraphs between my tables and I'd like only one. The problem I'm running into is that the original selection I've highlighted is lost as my table1 macro is run on each table. Is there a way to save my original selection from the start and recall it after the two macros have run to then run my find and replace macro? Thanks!!
Sub ParagraphCleanup()
'
' ParagraphCleanup Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub