-
Jul 4th, 2014, 04:18 AM
#1
Thread Starter
Lively Member
[RESOLVED] Copy to a specified document, instead of a new
Hello guys,
I am struggling with copying content between 2 documents.
my problem is.
instead of copy the content I got, into a new document,(newDoc)
I want my macro to open the file located ("C:/blabla.dot")
and paste the content
Here is my code see below,
I tried a couple of ways of replace the variable newDoc to match the file.
but I dont get it.
See code below
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "Claims"
.Font.Name = "Arial"
.Font.Bold = True
Do While .Execute
oRng.MoveEndUntil Chr(11)
oRng.MoveEnd wdCharacter, 1
oRng.MoveEndUntil Chr(11)
oRng.HighlightColorIndex = wdBrightGreen
oRng.Collapse wdCollapseEnd
Loop
End With
Dim thisdoc As Document
Dim newDoc As Document
Dim st
Set thisdoc = ActiveDocument
Set newDoc = Documents.Add
Documents(thisdoc).Activate
For Each st In ActiveDocument.StoryRanges
st.Find.ClearFormatting
st.Find.Text = ""
st.Find.Highlight = True
While st.Find.Execute
st.Copy
Documents(newDoc).Activate
Selection.Paste
Selection.Collapse direction:=wdCollapseEnd
Selection.Move Unit:=wdStory
Documents(thisdoc).Activate
Wend
Next
With newDoc
Documents(newDoc).Activate
Selection.WholeStory
Options.DefaultHighlightColorIndex = wdNoHighlight
Selection.Range.HighlightColorIndex = wdNoHighlight
Selection.Font.Bold = wdToggle
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
End With
End Sub
Please help a newb out
Thank you in advance
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|