Know what, but not how

L

libby

hi
I know what I want to do, but don't know how to do it.

DocumentA contains several text boxes.
When the user clicks a button another (already existing)
documentB is opened and the contents of each text box
pasted in.
I then want documentB to print and to close without saving
the changes.

Any ideas?
 
H

Helmut Weber

Hi Libby,
like this: Note that the most recently loaded
of 2 documents is documents(1). Therefore
I'm assigning doc1 to B and doc2 to A:
' Set dA = Documents(2)
' Set dB = Documents(1)
Sub Test234
Dim dA As Document
Dim dB As Document
Documents.Open "C:\test\documentB.doc"
Set dA = Documents(2)
Set dB = Documents(1)
dA.Activate
Dim s As Shape
For Each s In ActiveDocument.Shapes
With s.TextFrame
If .HasText Then dB.Range.InsertAfter .TextRange.Text
End With
Next
dB.PrintOut Background:=False
dB.Saved = True
dB.Close
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top